-
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
Source Generator load failure is unclear when it references a newer version of the compiler than the build uses #54710
Comments
Can you grab binary logs for both the builds that are succeeding and failing? Comparing them should give us an idea on what is going on here. To get a binary log just add the |
@jaredpar certainly.. thanks for the quick reply!! Coming right up. |
@jaredpar GitHub doesn't allow me to attach that file type here. Is there some other channel I can share it with you on? Happy to open a support ticket if need be. I poked around the log myself and didn't find tons, but you will probably find more than I will. I would imagine you'll also ask for the logs of the succeeding build on Linux, which I am also happy to provide. |
@alexrosenfeld10 Keep in mind the binlog will contain all environment variables and a bunch of other data specific to your machine. I recommend submitting a feedback ticket through the Report a Problem tool (covered by Microsoft data privacy policy) instead of posting it here (public). |
Thanks @sharwell . I did check that I don't have any env vars I'm worried about. I'll open something up there, thanks for linking! You updated it literally while I was about to ask. |
Thing is, this isn't a problem with VS. It's a general problem with source generators, and can be replicated outside of the IDE in a CLI setting alone. |
That's fine. We can link the internal report to this issue. |
Ok. @sharwell I don't have Visual Studio, I use Rider / CLI... So, instead I opened one on https://my.visualstudio.com/GetHelp - the case number is 2107090040003568 |
unfortunately there was no way to attach a file on that case. Let me know how best to proceed here! |
You can try opening a feedback issue directly and uploading there https://developercommunity.visualstudio.com/report?entry=suggestion&space=8 |
After a few tries it started working. Submitting one now... |
Here's the link: Is this private? My colleague is able to view the link without even signing in. I would just like to share these logs in a secure channel... |
The issue is public, but the attachment(s) are not. When you add a reply comment to attach the file(s), it will ask you to select the visibility. |
got it. Uploaded as private to microsoft. Thanks. That's the failing build btw, let me know if you need the successful linux build |
@alexrosenfeld10 thanks for the bin logs, super helpful. The error on the failure case is that the generator is dependent on You have two options to fix this:
Let me know if that fixes the build for you. |
@chsienki @jaredpar @sharwell thanks a bunch! That's super helpful. This worked for me, I'm back up and running. I use https://github.com/isen-ng/homebrew-dotnet-sdk-versions and I You've all been helpful, thanks again. |
Just curious, perhaps there's some release note I missed. Seems a bit tricky to change what binaries get shipped like this. Regardless, I'm all set now so I'll close this out. |
Situation we could possibly make better when we implement #54108 |
So that it works in lower versions of the SDK e.g. see dotnet/roslyn#54710 (comment)
Still getting bit by this, and this issue was not the most straightforward to find. Could this be annotated somewhere close to https://docs.microsoft.com/en-us/dotnet/csharp/roslyn-sdk/source-generators-overview ? |
Same Problem But I'm Using visual studio |
@alexrosenfeld10 The following line from the original post is concerning as well:
Source generators are required to target netstandard2.0. Generators targeting netstandard2.1 are not supported and are likely to not work. |
@hammypants @wisamidris7 This issue was fixed by #54108 (support declaring required Roslyn versions in analyzer packages) and #61252 (provide a specific error message if the analyzer is newer than the compiler). If you continue having problems, it would be best to file a new issue. |
Duplicate of #61252 |
@sharwell Yeah I was tinkering around with what works / doesn't work for source generators at the time. In most cases, they did work on 2.1, actually. I understand that's not a guarantee though. Glad to hear the error messages and fine tuning of versions is in place! |
So that it works in lower versions of the SDK e.g. see dotnet/roslyn#54710 (comment)
So that it works in lower versions of the SDK e.g. see dotnet/roslyn#54710 (comment)
Please note
This does not happen when running on Linux. The same exact project compiles and runs normally in any linux environment, but fails on Windows and macOS. This problem started seemingly spontaneously, and has been replicated on various
dotnet
SDK versions (including5.0.204
,5.0.203
, and5.0.202
).I have also checked out old commits in my repo that are known to have compiled on macOS and Windows in the past, and they now show the same issue. This suggests something that has changed in the NuGet packages themselves, or some other external factor.
I have also posted about this here: https://stackoverflow.com/questions/68273070/c-sharp-source-generator-cannot-be-created
Version Used:
Steps to Reproduce:
dotnet build
.Expected Behavior:
The solution builds normally.
Actual Behavior:
The text was updated successfully, but these errors were encountered: