Skip to content

Using ModuleInitializer within source generator does not work #49048

Answered by Cheatoid
Cheatoid asked this question in Q&A
Discussion options

You must be logged in to vote

Well this one is strange, but I just figured what is preventing it from working.
After several hours of trial and error...
In my source generator csproj I had:

<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.10.0-1.final" PrivateAssets="all"/>

For whatever reason that makes it not working.
I tried out some different (older) version:

<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.8.0" PrivateAssets="all"/>

And bam, it just magically works now. I am very much confused as to why this is...
To confirm it, I switched back to the newer version, and guess what -- it doesn't work again.
So it is literally something about the newer version which makes it …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@alexrp
Comment options

Answer selected by Cheatoid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants