VS 16.8 Preview 3 breaks Source Generators
See original GitHub issueVersion Used:
Version 16.8.0 Preview 3.0, updated from Preview 2.0 via VS installer.
Steps to Reproduce:
- Use SG Sample from roslyn-sdk
- Update all packages
- Build
Expected Behavior:
No error
Actual Behavior:
CSC : warning CS8032: An instance of analyzer SourceGeneratorSamples.HelloWorldGenerator cannot be created from ...\roslyn-sdk\artifacts\bin\SourceGeneratorSamples\Debug\netstandard2.0\SourceGeneratorSamples.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.
-> Same error for all SG
Reverting Microsoft.CodeAnalysis 3.8.0-2.final to 3.7.0 solves the problem somehow.
Updates:
Microsoft.CodeAnalysis.Common.3.8.0-2.final -> Microsoft.CodeAnalysis.Common.3.7.0 Microsoft.CodeAnalysis.CSharp.3.8.0-2.final -> Microsoft.CodeAnalysis.CSharp.3.7.0 System.Collections.Immutable.5.0.0-preview.8.20371.14 -> System.Collections.Immutable.1.5.0 System.Reflection.Metadata.5.0.0-preview.8.20371.14 -> System.Reflection.Metadata.1.6.0
Tried the same for the Blazor problem demo project: blazor-with-source-generators-poc
But no luck here when reverting Microsoft.CodeAnalysis 3.8.0-2.final to 3.7.0. Even the Console App build fails already:
CSC : warning CS8032: An instance of analyzer SourceGeneratorSamples.HelloWorldGenerator cannot be created from ...\blazor-with-source-generators-poc\src\SourceGen\bin\Debug\netstandard2.0\SourceGen.dll : Method 'Initialize' in type 'SourceGeneratorSamples.HelloWorldGenerator' from assembly 'SourceGen, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation..
CS0103 The name 'HelloWorldGenerated' does not exist in the current context ConsoleApp1
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (6 by maintainers)
@chsienki I assume we are going to publish the preview 3 nuget packages?
Sure this works now, but not without adding an additional preview source! Microsoft.CodeAnalysis.CSharp needs to be version 3.8.0-4.20464.1 from:
and not the shipped one from VS 16.8 p3 with dotnet-sdk-5.0.100-rc.1.20452.10.