Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[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: 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.
- Loading branch information