Skip to content

Commit a39cefa

Browse files
authored
[msbuild] Fix nullability issue when compiling for legacy Xamarin. (#17716)
And make sure we don't ignore any such warnings again for a few test projects.
1 parent 3e86254 commit a39cefa

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

tests/common/DotNet.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,11 @@ public static ExecutionResult AssertNew (string outputDirectory, string template
9191
args.Add (name!);
9292
}
9393

94+
#if NET
9495
if (!string.IsNullOrEmpty (language)) {
96+
#else
97+
if (language is not null && !string.IsNullOrEmpty (language)) {
98+
#endif
9599
args.Add ("--language");
96100
args.Add (language);
97101
}

tests/msbuild/Xamarin.MacDev.Tasks.Tests/Xamarin.MacDev.Tasks.Tests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<DefineConstants>$(DefineConstants);MSBUILD_TASKS</DefineConstants>
99
<SignAssembly>true</SignAssembly>
1010
<AssemblyOriginatorKeyFile>../../../product.snk</AssemblyOriginatorKeyFile>
11+
<WarningsAsErrors>Nullable</WarningsAsErrors>
1112
</PropertyGroup>
1213

1314
<!--

tests/msbuild/Xamarin.MacDev.Tests/Xamarin.MacDev.Tests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<LangVersion>latest</LangVersion>
88
<SignAssembly>true</SignAssembly>
99
<AssemblyOriginatorKeyFile>../../../product.snk</AssemblyOriginatorKeyFile>
10+
<WarningsAsErrors>Nullable</WarningsAsErrors>
1011
</PropertyGroup>
1112
<ItemGroup>
1213
<PackageReference Include="NUnit" Version="3.12.0" />

0 commit comments

Comments
 (0)