This repository serves as a minimal reproduction for a bug I found with Source Generators.
- Install .NET 7 (tested with 7.0.306)
- Run
dotnet build
in thesrc
folder - In
src\TestGenerator\TestGenerator.cs
change the type name fromTestGenerator1
toTestGenerator2
- Run
dotnet clean
in thesrc
folder (otherwise the build does not re-run) - Run
dotnet build
in thesrc
folder
- The build finishes without a warning
- There is a warning:
CSC : warning CS8032: An instance of analyzer TestGenerator.TestGenerator2 cannot be created from <localPath>\src\TestGenerator\bin\Debug\netstandard2.0\TestGenerator.dll : Could not load type 'TestGenerator.TestGenerator4' from assembly 'TestGenerator, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.. [<localPath>\src\TestGenerator.Tests\TestGenerator.Tests.csproj]
- When I manually check the dll in the location via ILSpy, the requested type is there