-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Possible regression between Preview 8 and Release Candidate 1: Source Generators issue #13869
Comments
@dsplaisted Mind taking a quick look if this is something we should investigate for GA? |
Looks like ProduceReferenceAssembly may not be working correctly together with source generators. @jaredpar, can you route to someone who can look at the source generators side of this? |
There was a breaking change to the generator implementation in the Roslyn version referenced between preview8 and RC1. Please see the following guide to update to latest https://github.com/dotnet/roslyn/blob/master/docs/features/source-generators.cookbook.md#breaking-changes |
Hi @chsienki & others, thank you for your research on my issue. I, unfortunately, missed that breaking change in source generators. |
Yes. The change occurred in Roslyn 3.8.0-3.final and the API is available going forward. At this stage the generators feature is still pre-release, and we wanted to make this breaking change before stabilizing the API. We're not expecting to make any further changes once released, or going forward with the pre-release. |
I've updated the cookbook to include some more information about the changes, and an example of the warning a user will see which should hopefully make it easier to diagnose in the future (and surface in search results). I'm going to close this out as I believe everything is working as expected, but please open an issue on the Roslyn repo if you're still seeing issues with the new API. |
Consider a simple two-project solution. One project is Source Generator with a single file:
Generator/HelloWorldGenerator.cs
Generator/Generator.csproj
Another project consumes the generated code:
Test/Program.cs
Test/Test.csproj
It can be compiled using
.NET 5.0.100-preview.8.20417.9
, both on Windows 10 x64 and in WSL 1 of the same system (both Win 10 and WSL Ubuntu 18.04 have the same SDK version).However, I have another machine which runs the same Windows 10 x64, but has
.NET 5.0.100-rc.1.20452.10
both for Windows and for WSL 2 Ubuntu 18.04. I am unable to compile the same project neither using Win nor *nix version.The error message provided is quite unusual:
Method
Initialize
is one of the two methods of interfaceISourceGenerator
, and is trivially implemented in the example above. I inspected the produced.dll
and foundIL
code for this method where it should be.Provided both machines pull exactly the same referenced packages, I am unable to pinpoint any other reason for why the project fails to compile other than something in RC1 is different compared to Preview8.
The text was updated successfully, but these errors were encountered: