Skip to content

Commit 65deefd

Browse files
committed
Failing tests for using nullability attributes in WPF codebehind
1 parent 000203e commit 65deefd

4 files changed

Lines changed: 60 additions & 0 deletions

File tree

appveyor.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ test_script:
4141
- msbuild /restore tests/SingleTFM /p:TestFramework=netcoreapp3.0 /warnaserror /nr:false /v:m
4242
- git clean -dxf tests
4343
- msbuild /restore tests/SingleTFM /p:TestFramework=netcoreapp3.1 /warnaserror /nr:false /v:m
44+
- git clean -dxf tests
45+
- msbuild /restore tests/WPF /warnaserror /nr:false /v:m
4446

4547
- git clean -dxf tests
4648
- dotnet msbuild -restore tests/MultiTFM -warnaserror -nr:false -v:m
@@ -70,5 +72,7 @@ test_script:
7072
- dotnet msbuild -restore tests/SingleTFM -p:TestFramework=netcoreapp3.0 -warnaserror -nr:false -v:m
7173
- git clean -dxf tests
7274
- dotnet msbuild -restore tests/SingleTFM -p:TestFramework=netcoreapp3.1 -warnaserror -nr:false -v:m
75+
- git clean -dxf tests
76+
- dotnet msbuild -restore tests/WPF -warnaserror -nr:false -v:m
7377
artifacts:
7478
- path: 'TunnelVisionLabs.ReferenceAssemblyAnnotator\**\*.nupkg'

tests/WPF/UserControl1.xaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<UserControl x:Class="WPF.UserControl1"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
5+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:local="clr-namespace:WPF"
7+
mc:Ignorable="d"
8+
d:DesignHeight="450" d:DesignWidth="800">
9+
<Grid>
10+
11+
</Grid>
12+
</UserControl>

tests/WPF/UserControl1.xaml.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using System.Collections.Generic;
2+
using System.Data.SqlClient;
3+
using System.Diagnostics.CodeAnalysis;
4+
using System.Windows.Controls;
5+
6+
namespace WPF
7+
{
8+
public partial class UserControl1 : UserControl
9+
{
10+
public UserControl1()
11+
{
12+
InitializeComponent();
13+
}
14+
15+
public static void M(SqlConnection connection, [AllowNull] string? x)
16+
{
17+
if (!string.IsNullOrEmpty(x))
18+
{
19+
x.ToString();
20+
}
21+
22+
_ = EqualityComparer<string?>.Default.GetHashCode(x);
23+
}
24+
}
25+
}

tests/WPF/WPF.csproj

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
2+
3+
<PropertyGroup>
4+
<!-- Using net40 instead of net35. jnm2.ReferenceAssemblies.net35 isn't automatically referenced by the .NET Core SDK like
5+
Microsoft.NETFramework.ReferenceAssemblies is, and therefore it doesn't provide assemblies to the WPF temp assembly project. -->
6+
<TargetFrameworks>net40;net48;netcoreapp3.0;netcoreapp3.1</TargetFrameworks>
7+
<UseWPF>true</UseWPF>
8+
<LangVersion>8</LangVersion>
9+
<Nullable>enable</Nullable>
10+
<NoWarn>RA1000</NoWarn>
11+
</PropertyGroup>
12+
13+
<ItemGroup>
14+
<PackageReference Condition="'$(TargetFramework)' != 'net40'" Include="System.Data.SqlClient" Version="4.8.0" />
15+
<PackageReference Include="TunnelVisionLabs.ReferenceAssemblyAnnotator" Version="1.0.0-alpha.*" PrivateAssets="all" />
16+
<PackageDownload Include="Microsoft.NETCore.App.Ref" Version="[3.1.0]" />
17+
</ItemGroup>
18+
19+
</Project>

0 commit comments

Comments
 (0)