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

Type name conflicts in PowerShell after moving to .Net 6.0 Preview7 #57017

Closed
iSazonov opened this issue Aug 7, 2021 · 4 comments
Closed

Type name conflicts in PowerShell after moving to .Net 6.0 Preview7 #57017

iSazonov opened this issue Aug 7, 2021 · 4 comments
Labels
tracking-external-issue The issue is caused by external problem (e.g. OS) - nothing we can do to fix it directly untriaged New issue has not been triaged by the area owner

Comments

@iSazonov
Copy link
Contributor

iSazonov commented Aug 7, 2021

Description

See PowerShell/PowerShell#15886 It is very amazing to see such name conflicts.

  1. System.Management.Automation.ExecutionContext vs System.Threading.ExecutionContext

Proposal is to rename System.Threading.ExecutionContext to System.Threading.ThreadExecutionContext

"ExecutionContext" is such a common pattern that there will be conflicts in many projects.

  1. System.Management.Automation.DriveNotFoundException vs System.IO.DriveNotFoundException

I haven't exact proposal. If we renamed System.Management.Automation.DriveNotFoundException to System.Management.Automation.PSDriveNotFoundException in PowerShell repository this would be a breaking change. I feel it is not accessible /cc @SteveL-MSFT @adityapatwardhan

I hope .Net can find alternative name for System.IO.DriveNotFoundException (maybe IODriveNotFoundException?)

Regression?

Regression in PowerShell after moving to .Net Core 6.0 Preview.7.

@iSazonov iSazonov added the tenet-performance Performance related issue label Aug 7, 2021
@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Aug 7, 2021
@jkotas
Copy link
Member

jkotas commented Aug 7, 2021

Proposal is to rename System.Threading.ExecutionContext

ExecutionContext is a very old type introduced more than decade ago. Renaming it would be significant breaking change.

I think you are getting bitten by implicit namespaces feature. You may want to set:

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

in the Powershell repo to disable it. FWIW, it is what we have done in this repo as well.

@iSazonov
Copy link
Contributor Author

iSazonov commented Aug 7, 2021

it is what we have done in this repo as well.

@jkotas Thanks! Is the problem caused by changing the default values in Preview7?

@MichalStrehovsky
Copy link
Member

It's caused by implicit usings that add an implicit "using System.Threading" at the beginning of all CS files. The above properties disable the feature.

The feature is going to be disabled by default after Preview 7 because it causes trouble like this in existing code (and more): dotnet/sdk#19521

@jkotas jkotas added tracking-external-issue The issue is caused by external problem (e.g. OS) - nothing we can do to fix it directly and removed tenet-performance Performance related issue labels Aug 7, 2021
@jkotas jkotas closed this as completed Aug 7, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Sep 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
tracking-external-issue The issue is caused by external problem (e.g. OS) - nothing we can do to fix it directly untriaged New issue has not been triaged by the area owner
Projects
None yet
Development

No branches or pull requests

3 participants