-
Notifications
You must be signed in to change notification settings - Fork 468
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
PlatformCompatibilityAnalyzer: Assertions should work the same way as nullable #4190
Comments
@buyaa-n I thought we did have tests for this case? If not, can we add a regression test that fails? Also you may want to pull in the latest bits from RC2 branch to confirm it still repros. |
We have a test for one or two cases, don't have for all guard methods. Will check this out, thanks |
@mavasani it works for checking the |
Sample test using System;
using System.Diagnostics;
using System.Runtime.Versioning;
class Test
{
void M1()
{
Debug.Assert(OperatingSystemHelper.IsWindows());
new ClassSupportedWindows();
[|SupportedWindows10()|];
[|UnsupportedWindows()|];
}
void M2()
{
Debug.Assert(OperatingSystemHelper.IsOSPlatformVersionAtLeast(""Windows"", 10, 2));
SupportedWindows10();
new ClassSupportedWindows();
[|UnsupportedWindows()|];
}
void M3()
{
Debug.Assert(!OperatingSystemHelper.IsWindows());
[|SupportedWindows10()|];
[|new ClassSupportedWindows()|];
UnsupportedWindows(); // fails
}
[SupportedOSPlatform(""Windows10.0"")]
void SupportedWindows10() { }
[SupportedOSPlatform(""Windows"")]
class ClassSupportedWindows { }
[UnsupportedOSPlatform(""Windows"")]
void UnsupportedWindows() { }
} |
@buyaa-n |
@pranavkm Which version of the analyzer assembly/package are you using? If you are hitting this on the latest version, it might very well be in context of other code in the same method. Would you be able to provide us a standalone repro where you hit this? If not, based on @buyaa-n's comment we will not be able to make further progress. @buyaa-n we should still create a test-only PR to add the above test. |
@mavasani when and API has
Sure i can add the test |
Interesting, then I am wondering why it doesn't work for assert case as both should go down the same code path. Let me check... |
Default the Visit method to return the value for the operand. Fixes dotnet#4190
I'm using SDK v5.0.100-rc.2.20471.7. |
Yeah, i thought @pranavkm forgot to add the |
Fixed in release/dotnet5-rc2 with #4196 |
Consider:
The text was updated successfully, but these errors were encountered: