-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Update powershell to consume the latest preview packages for .NET Core 1.1.0 release (November) #2472
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…24530-04 from 9/30/2016)
…the latest dotnet.exe checks the existence of all TPA assemblies, including those built from the local projects
… especially the code that would run in TypeInitializer. This is because with the latest .NET Core packages (1.1.0 preview), calling static members from 'Microsoft.Win32.Registry' will raise 'PlatformNotSupportedException'.
…y don't work on UNIX platform. With this change, 'Registry' and 'Certificate' providers won't be compiled for UNIX PS.
…ertificate' provider in UNIX PS
|
Hi @daxian-dbw, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!
TTYL, MSBOT; |
andyleejordan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reviewed it all; just had no comments. Thanks for fixing the whitespace in the project.json files 😄
|
@andschwa Thanks Andy! It's quite easy to fix indentations in VIM, just |
| @@ -1,3 +1,4 @@ | |||
| #if !UNIX | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be nice to do this within the project.json, but it looks like project.json does not support conditional inclusion and exclusion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly. You can only exclude a file per target framework.
| private string[] _exclude = new string[0]; | ||
| } | ||
|
|
||
| #if !UNIX |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to see comments added explaining why it is excluded. It'll help us determine when it is appropriate to remove these ifdefs. This comment applies to all the new "#if !UNIX" additions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added comments to the instances that I think there might be a confusion. For rest of the #if !UNIX it's very obvious that the enclosing code doesn't apply to UNIX platform, and I think they are self-explained :)
| // Retrieves group policy settings based on the preference order provided: | ||
| // Dictionary<string, object> settings = GetGroupPolicySetting("Transcription", Registry.LocalMachine, Registry.CurrentUser); | ||
|
|
||
| // Calling static members of 'Registry' on UNIX will raise 'PlatformNotSupportedException' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is exactly what I am looking for on the other #if !UNIX additions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is an example where I think it might raise confusion, so I added comments.
| # runtime via reflection. However,it isn't exposed in the reference contract of | ||
| # 'System.Text.Encoding', and therefore we cannot use 'Encoding.Default' in our | ||
| # code. So we need to skip this encoding in the test. | ||
| continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you set a variable that controls whether the It in this loop is skipped? It'll satisfy the tracked skipping requirement that way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. Will do it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. Thanks!
…ad of ignoring it, so that we can keep track of this encoding issue
Resolving #2343
Updating with the latest .NET Core preview packages causes some regressions:
System.Runtime.Loader.AssemblyLoadContextcauses a regression in PSAssemblyLoadContext. The regression has been fixed on PS side.dotnet.exedoesn't verify the existence of assemblies that are built from the local projects when check the TPA deps assemblies, and thus we are able to remove IL assemblies after crossgen. However, the latestdotnet.exechecks the existence of locally built assemblies, so IL assemblies cannot be removed anymore.dotnet.exeloads IL assemblies in precedence, instead of NI assemblies. The symptom is that you will findPowerShellAssemblyLoadContext.dllis loaded by the default load context when both the IL and NI assemblies exist. But with RTM packages,PowerShellAssemblyLoadContext.ni.dllgets loaded by the default load context under the same circumstance. This doesn't affect us too much now becausePowerShellAssemblyLoadContexthandles the loading of other PS assemblies and it prefers NI over IL assemblies. However, when the legacy APIs are back and it's time to retire PSALC, our crossgen story will be broken if the default context prefer IL over NI. I will start a conversation with .NET Core team on this.Microsoft.Win32.Registrywill now raisePlatformNotSupportedExceptionwhen you call any static members of it on UNIX. In PS code, we call some of its static properties when initializing some types (e.g.System.Management.Automation.Utils), and that caused PS to crash in UNIX. This is fixed.#4, I found bothRegistryandCertificateproviders are shown up in UNIX PS. They don't work in UNIX at all, and should not be exposed (until we have a UNIX implementation ofCertificateprovider someday). They are now excluded from compilation for UNIX PS.[System.Text.Encoding]::Defaultis available via reflection at runtime (exposed bySystem.Private.CoreLib), but it's not exposed in the reference contract ofSystem.Text.Encoding, and thus we cannot use it in PS Code. This mismatch causes a redirection test to fail. The test is fixed to skipEncoding.Defaultfor now. I will check with .NET Core team to clarify this mismatch.Cert:\to test the error behavior when not using aFileSystemProviderdrive. The tests are fixed.