-
Notifications
You must be signed in to change notification settings - Fork 470
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
CA1416 about API not being available on Mac Catalyst when it is #7239
Comments
CC @buyaa-n |
Same issue here. If you're not using MacCatalyst, adding this before the namespace makes the warning disappear.
Thank you @rolfbjarne. |
I tried to debug this issue a bit and I think I figured out how to write a failing test in this repo: https://github.com/dotnet/roslyn-analyzers/pull/7526/files#diff-fe676a982c8118266a3aa3b031ca04dc69395a41f78ac1cd98a397d7e475c668R4141 (based on @rolfbjarne's test) I think that the reason why the analyzer misbehaves is:
I'm not 100 per cent sure this analysis is correct but it appears more or less to make sense so I tend to think it's more or less what happens. @buyaa-n Not sure if you are the right person to ping. If you are, does it make sense to you please? PS: I opened this #7526 PR in case somebody is able to fix the issue based on my previous text. I'm out of assigned time for this issue, so I cannot unfortunately finish it. |
Thank you @MartyIX your analysis looks correct. I have put up a PR that puts the suppressed maccatalyst attribute back in case ios was not suppressed. As I cannot contribute to your PR created separate PR. You can copy the changes into your PR and push the fix too. Hopefully the team will review any of the PRs and merge one soon |
Not seeking credits that hard. I'm very happy that my work was useful though. :) It's great to see this being fixed. |
Analyzer
Diagnostic ID: CA1416:
This call site is reachable on: 'iOS' 13.0 and later, 'maccatalyst' 15.0 and later. 'AppDelegate.DoSomething()' is only supported on: 'ios' 14.0 and later.
Describe the bug
An API decorated with
[SupportedOSPlatform("maccatalyst")]
(no version) doesn't seem to be detected as supported on Mac Catalyst.Steps To Reproduce
dotnet new ios
).SupportedOSPlatformVersion=13.0
in the csproj.AppDelegate
class / in AppDelegate.cs):Complete test project (+ binlog):
ios-plain-52d66f2.zip
Expected behavior
No warning.
Actual behavior
Note that the warning message is wrong on more than one account:
Additional context
Adding a version to the maccatalyst attribute text fixes the warning.
So there's no warning with this:
The text was updated successfully, but these errors were encountered: