Skip to content
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

Update Language Version to 10 and fix related issues #15886

Merged
merged 4 commits into from
Aug 9, 2021

Conversation

adityapatwardhan
Copy link
Member

PR Summary

Update the language version to 10 and add --self-contained switch.
Updating language version required to make some changes as it caused build break.

PR Context

These changes were required to take the .NET 6 preview 7 daily builds.

PR Checklist

@ghost ghost assigned rjmholt Aug 6, 2021
@adityapatwardhan adityapatwardhan added the CL-BuildPackaging Indicates that a PR should be marked as a build or packaging change in the Change Log label Aug 6, 2021
build.psm1 Outdated
Comment on lines 435 to 436
$Arguments = @("publish","/property:GenerateFullPaths=true", "/property:ErrorOnDuplicatePublishOutputFiles=false")
# Add --self-contained due to "warning NETSDK1179: One of '--self-contained' or '--no-self-contained' options are required when '--runtime' is used."
$Arguments = @("publish","/property:GenerateFullPaths=true", "/property:ErrorOnDuplicatePublishOutputFiles=false", "--self-contained")
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is going to be a change in the resulting build format going forward, isn't it? I don't think we've previously had self-contained executables for pwsh.

Copy link
Member Author

Choose a reason for hiding this comment

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

the --self-contained switch was implicit when we specify --runtime. Now if moving to .NET 6 Preview 7 we get an error for that. --self-contained creates a package with the required .NET framework assemblies, where are --no-self-contained creates a framework dependent package.

@@ -619,7 +619,7 @@ internal virtual bool CallShouldProcess(string path)
notSupported.ErrorRecord,
notSupported));
}
catch (DriveNotFoundException driveNotFound)
catch (System.Management.Automation.DriveNotFoundException driveNotFound)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I see a lot of conflicts with System.IO.DriveNotFoundException.

Can we rename System.Management.Automation.DriveNotFoundException to PSDriveNotFoundException?

Copy link
Member Author

Choose a reason for hiding this comment

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

That would be a breaking change. I do not believe it is needed right now.

@@ -217,7 +217,7 @@ protected override void ProcessRecord()
{
// Mark untrusted values for assignments to 'Global:' variables, and 'Script:' variables in
// a module scope, if it's necessary.
ExecutionContext.MarkObjectAsUntrustedForVariableAssignment(variable, scope, Context.EngineSessionState);
System.Management.Automation.ExecutionContext.MarkObjectAsUntrustedForVariableAssignment(variable, scope, Context.EngineSessionState);
Copy link
Collaborator

@iSazonov iSazonov Aug 7, 2021

Choose a reason for hiding this comment

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

Oh, maybe ask .Net team rename new System.Threading.ExecutionContext to System.Threading.ThreadExecutionContext before they release 6.0?

I created dotnet/runtime#57017

Copy link
Collaborator

Choose a reason for hiding this comment

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

Recommendation is

 <DisableImplicitNamespaceImports>true</DisableImplicitNamespaceImports>
<DisableImplicitNamespaceImports_DotNet>true</DisableImplicitNamespaceImports_DotNet>

and remove the workaround after Preview7.

Copy link
Member Author

Choose a reason for hiding this comment

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

I will add this workaround and file an issue to remove it after releases after preview 7, as it will be disabled.

Copy link
Collaborator

@rjmholt rjmholt left a comment

Choose a reason for hiding this comment

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

Yeah it feels to me like, at the very least, we should be preferring our namespace for the fully qualified type names. Even if we can't get changes from .NET, it should be possible to configure the namespace imports in a way that avoids all these changes to the type names in code.

@adityapatwardhan
Copy link
Member Author

@rjmholt As per the suggestion in dotnet/runtime#57017 I have added the workaround for disabling the implicit namespace addition feature. I also have filed an issue to remove the work around when the next preview build of .NET is available. Issue: #15894

@rjmholt rjmholt merged commit 2ebac33 into PowerShell:master Aug 9, 2021
@rjmholt rjmholt deleted the FixNetP7issues branch August 9, 2021 19:21
xtqqczze pushed a commit to xtqqczze/PowerShell that referenced this pull request Aug 9, 2021
@iSazonov iSazonov added this to the 7.2.0-preview.9 milestone Aug 10, 2021
@ghost
Copy link

ghost commented Aug 23, 2021

🎉v7.2.0-preview.9 has been released which incorporates this pull request.:tada:

Handy links:

@ghost
Copy link

ghost commented Sep 28, 2021

🎉v7.2.0-preview.10 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-BuildPackaging Indicates that a PR should be marked as a build or packaging change in the Change Log
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants