Skip to content

Commit

Permalink
[tests] fix 1,170 build warnings (#9137)
Browse files Browse the repository at this point in the history
There are lots of warnings like:

    .\dotnet-local.cmd build .\tests\Mono.Android-Tests\Runtime-Microsoft.Android.Sdk\Mono.Android.NET-Tests.csproj
    ...
    .\tests\Mono.Android-Tests\Java.Interop\JavaConvertTest.cs(134,20):
    warning CA1416: This call site is reachable on all platforms. 'Object' is only supported on: 'Android' 21.0 and later.
    (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1416)
    ...
    Build succeeded with 1192 warning(s) in 44.4s

Several APK test projects need to set:

    <SupportedOSPlatformVersion>21</SupportedOSPlatformVersion>

In order to keep the .NET analyzer happy.

After these changes:

    Build succeeded with 22 warning(s) in 38.4s
  • Loading branch information
jonathanpeppers authored Jul 25, 2024
1 parent f0c17fc commit ad82218
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<PropertyGroup>
<TargetFramework>$(DotNetAndroidTargetFramework)</TargetFramework>
<SupportedOSPlatformVersion>$(AndroidMinimumDotNetApiLevel)</SupportedOSPlatformVersion>
<OutputType>Library</OutputType>
<RootNamespace>Xamarin.Android.NUnitLite</RootNamespace>
<SignAssembly>true</SignAssembly>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

<PropertyGroup>
<TargetFramework>$(DotNetAndroidTargetFramework)</TargetFramework>
<SupportedOSPlatformVersion>$(AndroidMinimumDotNetApiLevel)</SupportedOSPlatformVersion>
<RootNamespace>Java.Interop_Tests</RootNamespace>
<AssemblyName>Java.Interop-Tests</AssemblyName>
<OutputType>Library</OutputType>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<PropertyGroup>
<TargetFramework>$(DotNetAndroidTargetFramework)</TargetFramework>
<SupportedOSPlatformVersion>$(AndroidMinimumDotNetApiLevel)</SupportedOSPlatformVersion>
<RootNamespace>Xamarin.Android.RuntimeTests</RootNamespace>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<PropertyGroup>
<TargetFramework>$(DotNetAndroidTargetFramework)</TargetFramework>
<SupportedOSPlatformVersion>21</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion>$(AndroidMinimumDotNetApiLevel)</SupportedOSPlatformVersion>
<RootNamespace>Xamarin.Android.RuntimeTests</RootNamespace>
<OutputType>Exe</OutputType>
<SignAssembly>true</SignAssembly>
Expand Down
1 change: 1 addition & 0 deletions tests/TestRunner.Core/TestRunner.Core.NET.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<PropertyGroup>
<TargetFramework>$(DotNetAndroidTargetFramework)</TargetFramework>
<SupportedOSPlatformVersion>$(AndroidMinimumDotNetApiLevel)</SupportedOSPlatformVersion>
<OutputType>Library</OutputType>
<RootNamespace>Xamarin.Android.UnitTests</RootNamespace>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
Expand Down
1 change: 1 addition & 0 deletions tests/TestRunner.NUnit/TestRunner.NUnit.NET.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<PropertyGroup>
<TargetFramework>$(DotNetAndroidTargetFramework)</TargetFramework>
<SupportedOSPlatformVersion>$(AndroidMinimumDotNetApiLevel)</SupportedOSPlatformVersion>
<OutputType>Library</OutputType>
<RootNamespace>Xamarin.Android.UnitTests.NUnit</RootNamespace>
<AssemblyName>TestRunner.NUnit.NET</AssemblyName>
Expand Down

0 comments on commit ad82218

Please sign in to comment.