8000 Remove a type conversion for CommaDelimitedStringCollection by iSazonov · Pull Request #11000 · PowerShell/PowerShell · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@iSazonov
Copy link
Collaborator
@iSazonov iSazonov commented Nov 6, 2019

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 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 iSazonov added this to the 7.0.0-preview.6 milestone Nov 6, 2019
if (toType == typeof(StringCollection))
{
ConversionRank rank = (fromType.IsArray || IsTypeEnumerable(fromType)) ? ConversionRank.Language : ConversionRank.LanguageS2A;
return CacheConversion<StringCollection>(fromType, toType, LanguagePrimitives.ConvertToStringCollection, rank);
Copy link
Collaborator

Choose a reason for hiding this comment

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

@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

if (toType == typeof(StringCollection))
{
ConversionRank rank = (fromType.IsArray || IsTypeEnumerable(fromType)) ? ConversionRank.Language : ConversionRank.LanguageS2A;
return CacheConversion<StringCollection>(fromType, toType, LanguagePrimitives.ConvertToStringCollection, rank);
Copy link
Collaborator

Choose a reason for hiding this comment

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

@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

if (toType == typeof(StringCollection))
{
ConversionRank rank = (fromType.IsArray || IsTypeEnumerable(fromType)) ? ConversionRank.Language : ConversionRank.LanguageS2A;
return CacheConversion<StringCollection>(fromType, toType, LanguagePrimitives.ConvertToStringCollection, rank);
Copy link
Collaborator

Choose a reason for hiding this comment

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

@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

'System.ComponentModel.dll'
'System.ComponentModel.Primitives.dll'
'System.ComponentModel.TypeConverter.dll'
'System.Configuration.ConfigurationManager.dll'
Copy link
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.

Copy link
Collaborator Author
@iSazonov iSazonov Nov 7, 2019

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.

Copy link
Collaborator Author
@iSazonov iSazonov Nov 7, 2019

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
Collaborator Author

Choose a reason for hiding this comment

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

@daxian-dbw @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
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.

7440
Copy link
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
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 iSazonov force-pushed the cleanup-stringcomma branch from 2de5f67 to 3740994 Compare November 9, 2019 06:04
@iSazonov iSazonov force-pushed the cleanup-stringcomma branch from 3740994 to cd46f2d Compare November 13, 2019 04:01
@iSazonov iSazonov changed the title Enable a type conversion for CommaDelimitedStringCollection Remove a type conversion for CommaDelimitedStringCollection Nov 13, 2019
@daxian-dbw daxian-dbw merged commit 525dcfe into PowerShell:master Nov 13, 2019
@iSazonov iSazonov deleted the cleanup-stringcomma branch November 14, 2019 03:07
@ghost
Copy link
ghost commented Nov 21, 2019

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

Handy links:

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

0