-
Notifications
You must be signed in to change notification settings - Fork 4.7k
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Platform names correctness analyzer fails for OSPlatform attributes added in AssemblyInfo.cs file #49323
Comments
Tagging subscribers to this area: @safern, @ViktorHofer, @Anipik Issue DetailsRelated to #45851 Recently we added new analyzer which checks platform name/version correctness for
It is basically because the SDK adding the attribute for the target platform into I can fix it easily by updating the analyzer to not analyze a generated files, but not sure if we want to do any other fix instead as i assume it is only runtime specific issue CC @jeffhandley @terrajobst @safern @ViktorHofer @Anipik
|
Instead of ignoring generating files, I'd prefer to ensure our build (or the SDK) injects the correct assembly-level attributes, that we use the
|
Yeah, but we have Unix target, I don't have any solution except disabling the analyzer for generated files
We are defaulting the version to 1.0: runtime/eng/targetframeworksuffix.props Lines 8 to 10 in 3eca9e1
That is a good point, i forgot about that
Nothing except disabling it for generated files 😛
No, that is found in Overall there is 92 warnings, here i only showed non repeated scenarios. Forgot to add one more interesting scenario which is found on src builds (not in generated files):
These are all warnings found in src, but somehow suppressed after disabling the analyzer for generated files even it is not generated. |
If Unix is a valid target for us, couldn't we use the
Ah, I see; thanks. I recommend we add a condition to
Disabling it for generated files seems like a drastic step if the platform is valid for us. Maybe we could use
Oh I think I understand. Is this happening because for the down-level targets ( If that's the case, then I think the 2 options would be:
I don't think we should disable the analyzer on generated files as a result of these warnings. These so far all look like legitimate scenarios that we should have the analyzer checking for us to ensure we have our loose ends tied up on our build. |
Yes, I was thinking to use that if I see a warning in src, didn't felt it worth for generated files 😛, but of course we can add that
The versions might added on purpose cc @Anipik, I am wondering if we could use version 0.0 instead
Right
That assembly doesn't have any 5.0 or higher target though, so i am guess we still wanted the attribute for lower versions, if that is the case i will try the hook
Copy that, but for those src files we might could not add the |
I was not able to handle the warnings related to versions:
As i mentioned before we are defaulting the version to 1.0: runtime/eng/targetframeworksuffix.props Lines 8 to 11 in 3eca9e1
I have tried to set it to version 0.0, got build error:
Tried to not set version at all for browser or Linux build, got same error:
Seems MSBuild requires a version with non |
I guess these warnings have a unique diagnostic ID. Can we disable them in dotnet/runtime for downlevel targets where the |
Yes we can do that, or as @jeffhandley mentioned:
the most problematic one right now is the versions added for |
I see. Have you tried conditioning our setting of |
Yes, i have tried with a condition to not add versions conditionally, build error because it is used in the below statement Also tried conditionally set the entire TFM logic, including not set
Seems MSBuild not allowing version less TFM at all |
This is necessary for our custom RIDs to work. @Anipik can share more details. |
Got it thanks, we resolved the issue using |
@buyaa-n what's left to do here? Do we have a subscription that makes sure that the latest analyzer package is always used in dotnet/runtime? |
@ViktorHofer I have resolved the warning and was waiting for analyzer updates built for dogfood, now that is available so raised a PR, please review
I don't think so, as far as i know we update it manually, but i think that is better |
Related to #45851
Recently we added new analyzer which checks platform name/version correctness for
SupportedOSPlatform and UnsupportedOSPlatform
attributes usage, testing the analyzer with runtime repo produced warnings for generated filesXYZ.AssemblyInfo.cs
, see logs belowIt is basically because the SDK adding the attribute for the target platform into
XYZ.AssemblyInfo.cs
file, and that platform is not exist in the MSBuild supported platforms list or not expected to have a version part.I can fix it easily by updating the analyzer to not analyze a generated files, but not sure if we want to do any other way of fix instead as i assume it is only runtime specific issue
CC @jeffhandley @terrajobst @safern @ViktorHofer @Anipik
The text was updated successfully, but these errors were encountered: