-
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
Emit a warning when insufficient compiler version is used with the SDK #30304
Comments
@ericstj feel free to add/edit the issue if I didn't capture anything. |
Dunno if this is the right issue to piggy-back on. So kindly redirect me, if this is out of scope: I have a similar situation in the code-generator I authored, where I´d love to update to the most recent package version of This article here mostly describes the exact same situation I´m facing: I also tried to just bundle the used version of
To reproduce, just reference the (unlisted) version |
@earloc that might be more related to dotnet/roslyn-sdk#955 and #20355. |
@KalleOlaviNiemitalo thx for the direction, but I don´t think that´s the correct issue. But thx for the effort! For everyone else stumbling upon this: see dotnet/roslyn-sdk#1056 EDIT: gnahh, didn´t saw that second issue #20355 there. This looks like the right place. Thx again. |
@baronfel Yeah thx, I guess this issue contains the basics to enable my scenario. Just didn´t find any more documentation on how to actually achieve this. My experience with multi-targeting is a bit outdated... I once tackled with this just before (or around) I currently choose to just pin my dependency to remain supporting Luckily, my package doesn´t really do much with maybe latest fancy-pants features of the language, which might rise the need to actually support newer sdks. So that approach (pinning the dependency) is currently fine for me. |
I had similar case recently. Wrote my first generator. The project using it worked all right on Windows, but crashed on Mac.
It wasn't clear enough for me from the message, that it leads to source generator actually not being used, but since there were no other culprits I googled, downgraded the code analysis package to 4.6.0 and that's it. The project consuming generator is net7.0-win/mac, and I had latest VS and .NET7 SDK installed on both Mac and Win. I didn't test the case with .NET SDK installed and VS uninstalled on Mac. In such case however having different Roslyn versions embedded in toolchains (between .NET7 SDK Mac vs Win) would seems strange.
|
Is your feature request related to a problem? Please describe.
Recently we were debugging a failing issue which a scenario using Microsoft extensions logging source generator which requires C# compiler
4.4
. The user was using2022 VS v17.3.6
which using C# compiler4.3.0-3.22470.13 (80a8ce8d)
. The source generation in the project will fail to work and will end up with a compiler error like:C:\scratch\webApp\Program.cs(35,32): error CS8795: Partial method 'Log.Hello(ILogger, string)' must have an implementation part because it has accessibility modifiers. [C:\scratch\webApp\webApp.csproj]
which gives a hint there is a source generation problem but not clear what exactly the problem is especially compiling the same project on another machine happens to use compiler version4.4
make it succeed.Note, the project we were debugging was disabling the warning
CS9057
which was hiding more information about the failure. Had they not disabled this warning they would have seen numerous warnings:Describe the solution you'd like
When using SDK version (which allows source generation) with insufficient compiler version, should produce more logging to warn about the issue.
Additional context
This is easily can reproduce by creating a project and use the compiler version
4.3
and have some source generation code.The text was updated successfully, but these errors were encountered: