Skip to content

Commit

Permalink
Failing tests for using nullability attributes in WPF codebehind
Browse files Browse the repository at this point in the history
  • Loading branch information
jnm2 committed Jul 30, 2020
1 parent 000203e commit 65deefd
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 0 deletions.
4 changes: 4 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ test_script:
- msbuild /restore tests/SingleTFM /p:TestFramework=netcoreapp3.0 /warnaserror /nr:false /v:m
- git clean -dxf tests
- msbuild /restore tests/SingleTFM /p:TestFramework=netcoreapp3.1 /warnaserror /nr:false /v:m
- git clean -dxf tests
- msbuild /restore tests/WPF /warnaserror /nr:false /v:m

- git clean -dxf tests
- dotnet msbuild -restore tests/MultiTFM -warnaserror -nr:false -v:m
Expand Down Expand Up @@ -70,5 +72,7 @@ test_script:
- dotnet msbuild -restore tests/SingleTFM -p:TestFramework=netcoreapp3.0 -warnaserror -nr:false -v:m
- git clean -dxf tests
- dotnet msbuild -restore tests/SingleTFM -p:TestFramework=netcoreapp3.1 -warnaserror -nr:false -v:m
- git clean -dxf tests
- dotnet msbuild -restore tests/WPF -warnaserror -nr:false -v:m
artifacts:
- path: 'TunnelVisionLabs.ReferenceAssemblyAnnotator\**\*.nupkg'
12 changes: 12 additions & 0 deletions tests/WPF/UserControl1.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<UserControl x:Class="WPF.UserControl1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:WPF"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>

</Grid>
</UserControl>
25 changes: 25 additions & 0 deletions tests/WPF/UserControl1.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Diagnostics.CodeAnalysis;
using System.Windows.Controls;

namespace WPF
{
public partial class UserControl1 : UserControl
{
public UserControl1()
{
InitializeComponent();
}

public static void M(SqlConnection connection, [AllowNull] string? x)
{
if (!string.IsNullOrEmpty(x))
{
x.ToString();
}

_ = EqualityComparer<string?>.Default.GetHashCode(x);
}
}
}
19 changes: 19 additions & 0 deletions tests/WPF/WPF.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">

<PropertyGroup>
<!-- Using net40 instead of net35. jnm2.ReferenceAssemblies.net35 isn't automatically referenced by the .NET Core SDK like
Microsoft.NETFramework.ReferenceAssemblies is, and therefore it doesn't provide assemblies to the WPF temp assembly project. -->
<TargetFrameworks>net40;net48;netcoreapp3.0;netcoreapp3.1</TargetFrameworks>
<UseWPF>true</UseWPF>
<LangVersion>8</LangVersion>
<Nullable>enable</Nullable>
<NoWarn>RA1000</NoWarn>
</PropertyGroup>

<ItemGroup>
<PackageReference Condition="'$(TargetFramework)' != 'net40'" Include="System.Data.SqlClient" Version="4.8.0" />
<PackageReference Include="TunnelVisionLabs.ReferenceAssemblyAnnotator" Version="1.0.0-alpha.*" PrivateAssets="all" />
<PackageDownload Include="Microsoft.NETCore.App.Ref" Version="[3.1.0]" />
</ItemGroup>

</Project>

0 comments on commit 65deefd

Please sign in to comment.