-
Notifications
You must be signed in to change notification settings - Fork 4.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
Microsoft.CodeAnalysis.CSharp 4.3.0 fail to build source generators #63919
Comments
it's still prevalent in Microsoft.CodeAnalysis.CSharp (Latest prerelease 4.4.0-3.22459.4) - had to downgrade to 4.2.0, too... |
Step 1 of the repro here is far too simplistic. Please provide a complete set of repro steps. In addition, you should be matching your version of SCI to what roslyn has, ideally not explicitly depending on it at all. Roslyn 4.4 depends on SCI 5.0, and this is what you must depend on as well. Consider just letting the transitive dependency flow to your project. |
@0Lucifer0 whereas both, 4.2.0 and 4.4.0-1.final both refrence SCI 5 correctly. (and i was on 4.4.0-3.22459.4) because i was trying to get something else to work, and that also referenced SCI 6) |
here is a solution where the error persists. The generator is in teh AutomationObjectGenerator, it is referenced by the WpfApp1 project.
You might have to add the nuget source in the commit message to your package sources, since i'm referencing prerelease roslyn packages. |
here is a small repro https://github.com/erwan-joly/source-generator-bug-repro |
I have also the same issue, but only when building with VS. The CI pipeline has no errors when building the projects with MSBuild. So it looks like it's only a VS issue. |
I created a branch for the error repro in my solution: |
We're also hitting this in the MVVM Toolkit - none of our test projects using the Roslyn 4.3.0 head can build at all 🥲 |
Is this the same as #63780 ? |
That's not doing the trick in the MVVM Toolkit test projects.
|
Bug whack-a-mole... the preview3 package we suggested may predate #63347. If you can add an additional nuget feed to your project then you might have success using the exact version we shipped in VS 17.3 (at time of writing). I can see we've had several people hit this. I'll follow up when we have a solution which addresses the root of the problem. |
Hey @RikkiGibson, I've tried adding the feed and using that Roslyn version, but I still get the same exception at build 🥲 |
Closing as a duplicate of #63780 |
This is due to #63318 and is fixed by #63347 which will come in the next VS/.NET SDK servicing release. In the meantime, simply updating the compiler to the version released by the PR should fix the issue. The version which contains the fix is |
Version Used:
Microsoft.CodeAnalysis.CSharp 4.3.0
Steps to Reproduce:
Small repro here: https://github.com/erwan-joly/source-generator-bug-repro
Expected Behavior:
It shouldn't fail the build. It's a regression as moving back to 4.2.0 compile fine
Actual Behavior:
warning CS8785: Generator 'Generator' failed to generate source. It will not contribute to the output and compilation errors may occur as a result. Exception was of type 'FileNotFoundException' with message 'Could not load file or assembly 'System.Collections.Immutable, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.'
The text was updated successfully, but these errors were encountered: