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

17.10 is causing MissingMethodException exceptions on upgrade #10411

Closed
jaredpar opened this issue May 24, 2024 · 11 comments
Closed

17.10 is causing MissingMethodException exceptions on upgrade #10411

jaredpar opened this issue May 24, 2024 · 11 comments
Labels
area-compiler Umbrella for all compiler issues

Comments

@jaredpar
Copy link
Member

jaredpar commented May 24, 2024

A number of customers reported the following error when moving to 17.10.
 

Unhandled Exception: System.MissingMethodException: Method not found: ‘System.Collections.Generic.IEnumerator1<Microsoft.CodeAnalysis.NodeStateEntry1<System.ValueTuple2<System.__Canon,System.__Canon>>> Microsoft.CodeAnalysis.NodeStateTable1.GetEnumerator()’.	... C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\Roslyn\Microsoft.CSharp.Core.targets	85

This is caused by using the 7.0.4xx NET SDK in VS 17.10. Those SDKs are not technically supported in this release but the feedback on this bug is strong enough that we're going to try and move forward with a patch to this problem.

In the meantime customers who hit this can work around it in a few different ways. The preferred work around is moving to a newer .NET SDK which is supported like 8.0.2xx or 8.0.3xx. If that is not possible then customers can do the following for individual projects hitting this issue:

dotnet add package Microsoft.Net.Compilers.Toolset --version 4.9.2

For larger solutions it’s likely easier to set that in a Directory.Build.props file so that impacts all projects:

<Project>
  <ItemGroup>
    <PackageReference Include="Microsoft.Net.Compilers.Toolset" Version="4.9.2">
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
      <PrivateAssets>all</PrivateAssets>
    </PackageReference>
  </ItemGroup>
</Project>

Note This is a temporary solution. Please uninstall this package after the fix is in 17.10 otherwise you will end up hitting issues with future Visual Studio updates.

@jaredpar jaredpar changed the title 17.10 is causing May 24, 2024
@JuanZamudioGBM
Copy link

JuanZamudioGBM commented May 24, 2024

This is caused by using the 7.0.4xx or 8.0.1xx .NET SDK in VS 17.10. Those SDKs are not technically supported in this release but the feedback on this bug is strong enough that we're going to try and move forward with a patch to this problem.

Is this mentioned in the release notes or somewhere else? I was not aware that those SDK's were not supported, If I had known I wouldn't have updated my VS.

@danroth27
Copy link
Member

Is this mentioned in the release notes or somewhere else? I was not aware that those SDK's were not supported, If I had known I wouldn't have updated my VS.

@JuanZamudioGBM Please refer to the .NET support policy here: https://dotnet.microsoft.com/platform/support/policy

@JuanZamudioGBM
Copy link

JuanZamudioGBM commented May 24, 2024

@danroth27 reading that page I would not have been able to figure out that 8.0.1xx was not supported in 17.10.
I know 7.xx is not supported any more but it would have been nice seeing a warning telling what SDK's were no longer supported in 17.10

Thanks for your time.

@danroth27
Copy link
Member

danroth27 commented May 24, 2024

@danroth27 reading that page I would not have been able to figure out that 8.0.1xx was not supported in 17.10. I know 7.xx is not supported any more but it would have been nice seeing a warning telling what SDK's were no longer supported in 17.10

@JuanZamudioGBM Ah, that's a good point. The .NET SDK versioning and lifecycle is covered here and the latest 8.0.1xx SDK is still supported (@jaredpar updated his above comment accordingly). So, if you're seeing problems with the latest 8.0.1xx patch, please let us know!

@paul-schroeder-msft
Copy link

So, I updated our global.json file to use version "8.0.300" of the SDK and that resolved the initial issue. However, we are now getting a ton of these errors during compilation (mostly in our test projects):

error CA1861: Prefer 'static readonly' fields over constant array arguments if the called method is called repeatedly and is not mutating the passed array

There are a handful of other errors, too. Yet, we have an .editorconfig file at a higher level with the following statement:

## Avoid constant arrays as arguments
dotnet_diagnostic.CA1861.severity = warning

It is like the build process is now ignoring our .editorconfig file and treating the diagnostic as an error instead of a warning. This might be a separate issue, which I'm still investigating, but it only started happening once we moved to a newer .NET SDK as recommended in this thread.

@jaredpar
Copy link
Member Author

@paul-schroeder-msft believe that you're running into this issue with editorconfig priorities

dotnet/roslyn#72889

@paul-schroeder-msft
Copy link

So, to solve this in the near term, what I did in order to get things compiling via Visual Studio, my local command line, and our build pipeline is:

  1. Change the SDK version in our global.json file to 8.0.300
    image

  2. Add this to the .csproj files for affected projects (because of the new compilation errors mentioned in a prior comment above):

	<PropertyGroup>
		<AnalysisLevelStyle>9.0</AnalysisLevelStyle>
		<NoWarn>CA1861,SA1101,SA1200,SA1629,SA1633</NoWarn>
	</PropertyGroup>

Thanks @jaredpar for the assistance!

@phil-allen-msft phil-allen-msft added the area-compiler Umbrella for all compiler issues label May 28, 2024
@jaredpar
Copy link
Member Author

Closing as 17.10.2 is now released

@SamehSaeed
Copy link

C# interactive window stop working on 17.10.2, it does not open at all, even after clean installation for windows & visual studio community

@jaredpar
Copy link
Member Author

@SamehSaeed please open a new issue on dotnet/roslyn for that as it's seemingly unrelated to this particular problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-compiler Umbrella for all compiler issues
7 participants
@jaredpar @danroth27 @SamehSaeed @JuanZamudioGBM @phil-allen-msft @paul-schroeder-msft and others