Skip to content

.NET SDK 6 Preview 7 generated file ImplicitNamespaceImports.cs contains error CS8773 #19702

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

Closed
andyleejordan opened this issue Aug 12, 2021 · 8 comments

Comments

@andyleejordan
Copy link
Member

Good morning,

I just tracked down a CI failure to a .NET SDK update. With dotnet v6.0.100-preview.7.21379.14 our whole build is failing with the repeated error:

...obj\Debug\net6.0\PowerShellEditorServices.Test.ImplicitNamespaceImports.cs(2,1):
error CS8773: Feature 'global using directive' is not available in C# 9.0. Please use language version 10.0 or greater.

This error did not show up last night, with the same build on the same code, but using dotnet v6.0.100-preview.6.21355.2. The big difference seeming to be Preview 6 to Preview 7.

I looked at #19446, but we do not (as far as I can find) use any <Import Include=...> statements in any of our .csproj files.

We are explicitly using language version 9.0, so I will update us to 10.0 to work around this, but it seems like there may be an underlying and unintended change between the two previews?

@KalleOlaviNiemitalo
Copy link
Contributor

#19599 already changed the feature to opt-in so the file will not be generated unless you set the ImplicitUsings property or define Using items. But this was merged after 6.0 preview 7. If you do not intend to use implicit usings in PowerShell, I suggest disabling them with DisableImplicitNamespaceImports until you can update to a version where they are disabled by default.

@andyleejordan
Copy link
Member Author

Is the issue that Preview 7 opted everyone in, and the opt-out by default wasn't merged in time to fix that for Preview 7?

@davidfowl
Copy link
Member

It’s changed in rc1 not preview 7

@AArnott
Copy link
Contributor

AArnott commented Aug 18, 2021

I just hit this when upgrading a project from the 5.0 SDK to 6.0.100-preview.7.21379.14.
My project explicitly sets LangVersion to 9. IMO the SDK shouldn't generate files that require C# 10 without confirming that the LangVersion is at least set to that level.

@andyleejordan
Copy link
Member Author

Yup, and I'm already looking to revert my language version back to 9.0 because I didn't realize that 10.0 would force all devs to update the SDK on their box to Preview 7 :/

@davidfowl
Copy link
Member

It'll be fixed in rc1 builds. For now you can disable the feature.

@andyleejordan
Copy link
Member Author

@davidfowl
Copy link
Member

More information on the latest changes #19521

@dsplaisted dsplaisted removed the untriaged Request triage from a team member label Aug 20, 2021
@dsplaisted dsplaisted removed their assignment Aug 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants