-
Notifications
You must be signed in to change notification settings - Fork 536
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
[tests] fix build warnings as errors in TestRunner.NUnit.NET #9739
Conversation
Context: #9732 In d3cde47, we made warnings -> errors on CI. In #9732, the `$(SupportedOSPlatformVersion)` Roslyn analyzer was "fixed" so it properly emits warnings now. This causes several errors: tests/TestRunner.NUnit/NUnitTestRunner.cs(43,35): error CA1416: This call site is reachable on all platforms. 'Application.Context' is only supported on: 'Android' 21.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416) [tests/TestRunner.NUnit/TestRunner.NUnit.NET.csproj] tests/TestRunner.NUnit/NUnitTestRunner.cs(43,35): error CA1416: This call site is reachable on all platforms. 'Context.PackageName' is only supported on: 'Android' 21.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416) [tests/TestRunner.NUnit/TestRunner.NUnit.NET.csproj] tests/TestRunner.NUnit/NUnitTestInstrumentation.cs(39,32): error CA1416: This call site is reachable on all platforms. 'Instrumentation.Context' is only supported on: 'Android' 21.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416) [tests/TestRunner.NUnit/TestRunner.NUnit.NET.csproj] tests/TestRunner.NUnit/NUnitTestInstrumentation.cs(70,4): error CA1416: This call site is reachable on all platforms. 'Log.Info(string?, string)' is only supported on: 'Android' 21.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416) [tests/TestRunner.NUnit/TestRunner.NUnit.NET.csproj] tests/TestRunner.NUnit/NUnitTestInstrumentation.cs(64,4): error CA1416: This call site is reachable on all platforms. 'Log.Info(string?, string)' is only supported on: 'Android' 21.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416) [tests/TestRunner.NUnit/TestRunner.NUnit.NET.csproj] tests/TestRunner.NUnit/NUnitTestInstrumentation.cs(76,4): error CA1416: This call site is reachable on all platforms. 'Log.Info(string?, string)' is only supported on: 'Android' 21.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416) [tests/TestRunner.NUnit/TestRunner.NUnit.NET.csproj] tests/TestRunner.NUnit/NUnitTestInstrumentation.cs(67,4): error CA1416: This call site is reachable on all platforms. 'Log.Info(string?, string)' is only supported on: 'Android' 21.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416) [tests/TestRunner.NUnit/TestRunner.NUnit.NET.csproj] tests/TestRunner.NUnit/NUnitTestInstrumentation.cs(73,4): error CA1416: This call site is reachable on all platforms. 'Log.Info(string?, string)' is only supported on: 'Android' 21.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416) [tests/TestRunner.NUnit/TestRunner.NUnit.NET.csproj] tests/TestRunner.NUnit/NUnitTestInstrumentation.cs(117,5): error CA1416: This call site is reachable on all platforms. 'Log.Info(string?, string)' is only supported on: 'Android' 21.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416) [tests/TestRunner.NUnit/TestRunner.NUnit.NET.csproj] tests/TestRunner.NUnit/NUnitTestInstrumentation.cs(110,5): error CA1416: This call site is reachable on all platforms. 'Log.Info(string?, string)' is only supported on: 'Android' 21.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416) [tests/TestRunner.NUnit/TestRunner.NUnit.NET.csproj] tests/TestRunner.NUnit/NUnitTestInstrumentation.cs(104,5): error CA1416: This call site is reachable on all platforms. 'Log.Info(string?, string)' is only supported on: 'Android' 21.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416) [tests/TestRunner.NUnit/TestRunner.NUnit.NET.csproj] tests/TestRunner.NUnit/NUnitTestInstrumentation.cs(94,6): error CA1416: This call site is reachable on all platforms. 'Log.Info(string?, string)' is only supported on: 'Android' 21.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416) [tests/TestRunner.NUnit/TestRunner.NUnit.NET.csproj] It appears this analyzer relies on `AssemblyInfo.cs` to determine the `$(SupportedOSPlatformVersion)` value. `$(GenerateAssemblyInfo)=false` appears to break this analyzer! This commit remove the `$(GenerateAssemblyInfo)=false` change to allow the .NET SDK to generate `AssemblyInfo.cs`. I also removed the `Properties/AssemblyInfo.cs` file, as it would create duplicate attributes. We do not *ship* this assembly, so the values in `AssemblyInfo.cs` are probably not important.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Weird, we have this in the .csproj
:
<SupportedOSPlatformVersion>$(AndroidMinimumDotNetApiLevel)</SupportedOSPlatformVersion>
But I suspect the way that actually makes it into the assembly as an [assembly:SupportedOSPlatformVersion ("")]
is via the AssemblyInfo.cs
that .NET generates with <GenerateAssemblyInfo>
.
I don't think it's a bug, because they support you using the attribute manually So, then if we prevent the attribute from being in the assembly, it doesn't work. One test lane timed out, but going to merge to unblock some of the .NET 10 bumps. |
Context: #9732 In d3cde47, we made warnings -> errors on CI. In #9732, the `$(SupportedOSPlatformVersion)` Roslyn analyzer was "fixed" so it properly emits warnings now. This causes several errors: tests/TestRunner.NUnit/NUnitTestRunner.cs(43,35): error CA1416: This call site is reachable on all platforms. 'Application.Context' is only supported on: 'Android' 21.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416) [tests/TestRunner.NUnit/TestRunner.NUnit.NET.csproj] tests/TestRunner.NUnit/NUnitTestRunner.cs(43,35): error CA1416: This call site is reachable on all platforms. 'Context.PackageName' is only supported on: 'Android' 21.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416) [tests/TestRunner.NUnit/TestRunner.NUnit.NET.csproj] tests/TestRunner.NUnit/NUnitTestInstrumentation.cs(39,32): error CA1416: This call site is reachable on all platforms. 'Instrumentation.Context' is only supported on: 'Android' 21.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416) [tests/TestRunner.NUnit/TestRunner.NUnit.NET.csproj] tests/TestRunner.NUnit/NUnitTestInstrumentation.cs(70,4): error CA1416: This call site is reachable on all platforms. 'Log.Info(string?, string)' is only supported on: 'Android' 21.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416) [tests/TestRunner.NUnit/TestRunner.NUnit.NET.csproj] tests/TestRunner.NUnit/NUnitTestInstrumentation.cs(64,4): error CA1416: This call site is reachable on all platforms. 'Log.Info(string?, string)' is only supported on: 'Android' 21.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416) [tests/TestRunner.NUnit/TestRunner.NUnit.NET.csproj] tests/TestRunner.NUnit/NUnitTestInstrumentation.cs(76,4): error CA1416: This call site is reachable on all platforms. 'Log.Info(string?, string)' is only supported on: 'Android' 21.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416) [tests/TestRunner.NUnit/TestRunner.NUnit.NET.csproj] tests/TestRunner.NUnit/NUnitTestInstrumentation.cs(67,4): error CA1416: This call site is reachable on all platforms. 'Log.Info(string?, string)' is only supported on: 'Android' 21.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416) [tests/TestRunner.NUnit/TestRunner.NUnit.NET.csproj] tests/TestRunner.NUnit/NUnitTestInstrumentation.cs(73,4): error CA1416: This call site is reachable on all platforms. 'Log.Info(string?, string)' is only supported on: 'Android' 21.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416) [tests/TestRunner.NUnit/TestRunner.NUnit.NET.csproj] tests/TestRunner.NUnit/NUnitTestInstrumentation.cs(117,5): error CA1416: This call site is reachable on all platforms. 'Log.Info(string?, string)' is only supported on: 'Android' 21.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416) [tests/TestRunner.NUnit/TestRunner.NUnit.NET.csproj] tests/TestRunner.NUnit/NUnitTestInstrumentation.cs(110,5): error CA1416: This call site is reachable on all platforms. 'Log.Info(string?, string)' is only supported on: 'Android' 21.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416) [tests/TestRunner.NUnit/TestRunner.NUnit.NET.csproj] tests/TestRunner.NUnit/NUnitTestInstrumentation.cs(104,5): error CA1416: This call site is reachable on all platforms. 'Log.Info(string?, string)' is only supported on: 'Android' 21.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416) [tests/TestRunner.NUnit/TestRunner.NUnit.NET.csproj] tests/TestRunner.NUnit/NUnitTestInstrumentation.cs(94,6): error CA1416: This call site is reachable on all platforms. 'Log.Info(string?, string)' is only supported on: 'Android' 21.0 and later. (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416) [tests/TestRunner.NUnit/TestRunner.NUnit.NET.csproj] It appears this analyzer relies on `AssemblyInfo.cs` to determine the `$(SupportedOSPlatformVersion)` value. `$(GenerateAssemblyInfo)=false` appears to break this analyzer! This commit removes `$(GenerateAssemblyInfo)=false` to allow the .NET SDK to generate `AssemblyInfo.cs`. I also removed the `Properties/AssemblyInfo.cs` file, as it would create duplicate attributes. We do not *ship* this assembly, so the values in `AssemblyInfo.cs` are probably not important.
* main: [tests] fix build warnings as errors in TestRunner.NUnit.NET (#9739)
Context: #9732
In d3cde47, we made warnings -> errors on CI.
In #9732, the
$(SupportedOSPlatformVersion)
Roslyn analyzer was "fixed" so it properly emits warnings now.This causes several errors:
It appears this analyzer relies on
AssemblyInfo.cs
to determine the$(SupportedOSPlatformVersion)
value.$(GenerateAssemblyInfo)=false
appears to break this analyzer!This commit remove the
$(GenerateAssemblyInfo)=false
change to allow the .NET SDK to generateAssemblyInfo.cs
. I also removed theProperties/AssemblyInfo.cs
file, as it would create duplicate attributes. We do not ship this assembly, so the values inAssemblyInfo.cs
are probably not important.