-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #82 from jnm2/wpf_workaround
Workaround to provide nullability attributes to WPF temp projects
- Loading branch information
Showing
5 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |