Skip to content

Remove a type conversion for CommaDelimitedStringCollection - #11000

Merged
Dongbo Wang (daxian-dbw) merged 5 commits into
PowerShell:masterfrom
iSazonov:cleanup-stringcomma
Nov 13, 2019
Merged

Dongbo Wang (daxian-dbw) merged 5 commits into
PowerShell:masterfrom
iSazonov:cleanup-stringcomma

Conversation

@iSazonov

@iSazonov Ilya (iSazonov) commented Nov 6, 2019 •

Copy link
Copy Markdown
Collaborator

PR Summary

Now CommaDelimitedStringCollection class is available in .Net Core 3.0 but after a discussion we decided to remove the old code as very rarely used.
Users can add the converter with Update-TypeData cmdlet if needed.

PR Context

PR Checklist

@iSazonov Ilya (iSazonov) added the CL-CodeCleanup Indicates that a PR should be marked as a Code Cleanup change in the Change Log label Nov 6, 2019
@iSazonov Ilya (iSazonov) added this to the 7.0.0-preview.6 milestone Nov 6, 2019
@@ -5006,13 +5006,11 @@ private static IConversionData FigureLanguageConversion(Type fromType, Type toTy
return CacheConversion<StringCollection>(fromType, toType, LanguagePrimitives.ConvertToStringCollection, rank);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ilya (@iSazonov), your last commit had 1 failures in PowerShell-CI-macos
Validate start of console host.No new assemblies are loaded

Expected exactly $null, but got @{InputObject=System.Configuration.ConfigurationManager.dll; SideIndicator==>}.
at <ScriptBlock>, /Users/runner/runners/2.160.0/work/1/s/test/powershell/Host/Startup.Tests.ps1: line 125
125:         $diffs | Should -BeExactly $null

@@ -5006,13 +5006,11 @@ private static IConversionData FigureLanguageConversion(Type fromType, Type toTy
return CacheConversion<StringCollection>(fromType, toType, LanguagePrimitives.ConvertToStringCollection, rank);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ilya (@iSazonov), your last commit had 2 failures in PowerShell-CI-windows
Enter-PSHostProcess tests.By CustomPipeName.Can enter, exit, and re-enter using CustomPipeName

Expected $true, because The script was able to re-enter another process and grab the pipe of 'lste30rz.0ra'., but got $false.
at <ScriptBlock>, D:\a\1\s\test\powershell\Modules\Microsoft.PowerShell.Core\Enter-PSHostProcess.Tests.ps1: line 170
170:                     Should -BeTrue -Because "The script was able to re-enter another process and grab the pipe of '$pipeName'."

Validate start of console host.No new assemblies are loaded

Expected exactly $null, but got @{InputObject=System.Configuration.ConfigurationManager.dll; SideIndicator==>}.
at <ScriptBlock>, D:\a\1\s\test\powershell\Host\Startup.Tests.ps1: line 125
125:         $diffs | Should -BeExactly $null

@@ -5006,13 +5006,11 @@ private static IConversionData FigureLanguageConversion(Type fromType, Type toTy
return CacheConversion<StringCollection>(fromType, toType, LanguagePrimitives.ConvertToStringCollection, rank);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ilya (@iSazonov), your last commit had 1 failures in PowerShell-CI-linux
Validate start of console host.No new assemblies are loaded

Expected exactly $null, but got @{InputObject=System.Configuration.ConfigurationManager.dll; SideIndicator==>}.
at <ScriptBlock>, /home/vsts/work/1/s/test/powershell/Host/Startup.Tests.ps1: line 125
125:         $diffs | Should -BeExactly $null

Comment thread test/powershell/Host/Startup.Tests.ps1 Outdated
'System.ComponentModel.dll'
'System.ComponentModel.Primitives.dll'
'System.ComponentModel.TypeConverter.dll'
'System.Configuration.ConfigurationManager.dll'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not worth it to add this converter to the cache at the very beginning.
This dll is 959 kb, almost 1mb, and this converter will rarely to be used (only for compatibility purpose). Pulling in the dll at startup time is not right.

@iSazonov Ilya (iSazonov) Nov 7, 2019 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes :-). Have you an idea how add ConvertToCommaDelimitedStringCollection() not at startup?

  • I wonder why did Windows PowerShell add this in cache?
  • Also I wonder why do we load so many dll-s at startup although it seems they are not used.

@iSazonov Ilya (iSazonov) Nov 7, 2019 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could add new converter using TypeTable_Types_Ps1Xml.cs like Microsoft.PowerShell.DeserializingTypeConverter but I guess that typeof(CommaDelimitedStringCollection) reference in the converter will load the assembly at startup. So we need a conclusion do we want to return back the Windows PowerShell feature.

Update: On Github I don't find PowerShell scripts using CommaDelimitedStringCollection. So we could remove the code as formally breaking change.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dongbo Wang (@daxian-dbw) Steve Lee (@SteveL-MSFT) Could you please make a conclusion should we add back the converter?

.Net Core (and .Net Framework) does not use it on CommaDelimitedStringCollection by default. I don't know why it was added in Windows PowerShell.
I think we could remove the code.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since PSCore6 didn't have this and I haven't seen any complaints about it along with your GitHub search it seems unlikely anyone missed that this was gone. So it seem we should not add it back given the size.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, then this PR can be closed 😄

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the old code in the PR and updated the PR description.

@ghost ghost added Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept and removed Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept labels Nov 6, 2019
@iSazonov Ilya (iSazonov) changed the title Enable a type conversion for CommaDelimitedStringCollection Remove a type conversion for CommaDelimitedStringCollection Nov 13, 2019
@daxian-dbw
Dongbo Wang (daxian-dbw) merged commit 525dcfe into PowerShell:master Nov 13, 2019
@iSazonov
Ilya (iSazonov) deleted the cleanup-stringcomma branch November 14, 2019 03:07
@ghost

Copy link
Copy Markdown

🎉v7.0.0-preview.6 has been released which incorporates this pull request.:tada:

Handy links:

Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj-contribs/PowerShell that referenced this pull request Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-CodeCleanup Indicates that a PR should be marked as a Code Cleanup change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants