Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test using the .NET 6 SDK and stop adding a duplicate compile item for WPF #90

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions CecilBasedAnnotator/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"profiles": {
"Microsoft.Win32.Primitives (netstandard1.6)": {
"commandName": "Project",
"commandLineArgs": "\"$(NuGetPackageRoot)\\microsoft.win32.primitives\\4.3.0\\ref\\netstandard1.3\\Microsoft.Win32.Primitives.dll\" \"$(NuGetPackageRoot)\\microsoft.win32.primitives\\4.3.0\\ref\\netstandard1.3\\;$(NuGetPackageRoot)\\system.runtime\\4.3.0\\ref\\netstandard1.5\\\\\" \"$(NuGetPackageRoot)\\microsoft.netcore.app.ref\\3.0.0\\ref\\netcoreapp3.0\\Microsoft.Win32.Primitives.dll\" Microsoft.Win32.Primitives.dll"
"commandLineArgs": "\"$(NuGetPackageRoot)\\microsoft.win32.primitives\\4.3.0\\ref\\netstandard1.3\\Microsoft.Win32.Primitives.dll\" \"$(NuGetPackageRoot)\\microsoft.win32.primitives\\4.3.0\\ref\\netstandard1.3\\;$(NuGetPackageRoot)\\system.runtime\\4.3.0\\ref\\netstandard1.5\\\\\" \"$(NuGetPackageRoot)\\microsoft.netcore.app.ref\\6.0.0\\ref\\net6.0\\Microsoft.Win32.Primitives.dll\" Microsoft.Win32.Primitives.dll"
},
"System.ComponentModel.DataAnnotations (netcoreapp2.0)": {
"System.ComponentModel.DataAnnotations (netcoreapp3.1)": {
"commandName": "Project",
"commandLineArgs": "\"$(NuGetPackageRoot)\\microsoft.netcore.app\\2.0.0\\ref\\netcoreapp2.0\\System.ComponentModel.DataAnnotations.dll\" \"$(NuGetPackageRoot)\\microsoft.netcore.app\\2.0.0\\ref\\netcoreapp2.0\\\\\" \"$(NuGetPackageRoot)\\microsoft.netcore.app.ref\\3.0.0\\ref\\netcoreapp3.0\\System.ComponentModel.DataAnnotations.dll\" System.ComponentModel.DataAnnotations.dll"
"commandLineArgs": "\"$(NuGetPackageRoot)\\microsoft.netcore.app\\3.1.0\\ref\\netcoreapp3.1\\System.ComponentModel.DataAnnotations.dll\" \"$(NuGetPackageRoot)\\microsoft.netcore.app\\3.1.0\\ref\\netcoreapp3.1\\\\\" \"$(NuGetPackageRoot)\\microsoft.netcore.app.ref\\6.0.0\\ref\\net6.0\\System.ComponentModel.DataAnnotations.dll\" System.ComponentModel.DataAnnotations.dll"
}
}
}
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<!-- Enable nullable reference types -->
<PropertyGroup>
<Nullable>enable</Nullable>
<AnnotatedReferenceAssemblyVersion>3.1.0</AnnotatedReferenceAssemblyVersion>
<AnnotatedReferenceAssemblyVersion>6.0.0</AnnotatedReferenceAssemblyVersion>
<GenerateNullableAttributes>false</GenerateNullableAttributes>
</PropertyGroup>

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ IL weaver for adding nullability annotations to .NET Framework, .NET Standard, a
<PackageReference Include="TunnelVisionLabs.ReferenceAssemblyAnnotator" Version="1.0.0-alpha.160" PrivateAssets="all" />

<!-- Specifies the version of Microsoft.NETCore.App.Ref to obtain nullability information from. -->
<PackageDownload Include="Microsoft.NETCore.App.Ref" Version="[5.0.0]" />
<PackageDownload Include="Microsoft.NETCore.App.Ref" Version="[6.0.0]" />
</ItemGroup>
```

Expand All @@ -58,7 +58,7 @@ Minimal:
```xml
<ItemGroup>
<PackageReference Include="TunnelVisionLabs.ReferenceAssemblyAnnotator" Version="1.0.0-alpha.160" PrivateAssets="all" />
<PackageDownload Include="Microsoft.NETCore.App.Ref" Version="[5.0.0]" />
<PackageDownload Include="Microsoft.NETCore.App.Ref" Version="[6.0.0]" />
</ItemGroup>
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public override bool Execute()
{
var log = new SuppressibleLoggingHelper(Log, requiredPrefix: "RA", DisabledWarnings);

string unannotatedReferenceAssembly = TargetFrameworkDirectories.Select(path => Path.Combine(path.ItemSpec, UnannotatedReferenceAssembly + ".dll")).FirstOrDefault(File.Exists);
string? unannotatedReferenceAssembly = TargetFrameworkDirectories.Select(path => Path.Combine(path.ItemSpec, UnannotatedReferenceAssembly + ".dll")).FirstOrDefault(File.Exists);
string annotatedReferenceAssembly = Path.Combine(AnnotatedReferenceAssemblyDirectory, UnannotatedReferenceAssembly + ".dll");
bool foundAnnotatedAssembly = File.Exists(annotatedReferenceAssembly);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ private ArrayDimensionEqualityComparer()
{
}

#pragma warning disable CS8614 // In CLI builds: Nullability of reference types in type of parameter 'x' of 'bool ArrayDimensionEqualityComparer.Equals(ArrayDimension x, ArrayDimension y)' doesn't match implicitly implemented member 'bool IEqualityComparer<ArrayDimension>.Equals(ArrayDimension x, ArrayDimension y)'.
public bool Equals(ArrayDimension x, ArrayDimension y)
Comment on lines +19 to 20
Copy link
Contributor Author

@jnm2 jnm2 Nov 21, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sharwell ArrayDimension is a struct coming from the Mono.Cecil package. This issue doesn't repro unless RAA is rewriting reference assemblies.

Not sure if this is an existing RAA problem when used normally or whether it's a regression introduced in this PR.

#pragma warning restore CS8614
{
return x.LowerBound == y.LowerBound
&& x.UpperBound == y.UpperBound;
Expand Down
6 changes: 3 additions & 3 deletions TunnelVisionLabs.ReferenceAssemblyAnnotator/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ private static bool IsExcludedAnnotation(ICustomAttributeProvider provider, ICus
return annotatedTypeDefinition;
}

private static MethodDefinition FindMatchingMethod(SuppressibleLoggingHelper? log, MethodDefinition methodDefinition, TypeDefinition annotatedTypeDefinition)
private static MethodDefinition? FindMatchingMethod(SuppressibleLoggingHelper? log, MethodDefinition methodDefinition, TypeDefinition annotatedTypeDefinition)
{
try
{
Expand All @@ -305,12 +305,12 @@ private static MethodDefinition FindMatchingMethod(SuppressibleLoggingHelper? lo
}
}

private static PropertyDefinition FindMatchingProperty(PropertyDefinition propertyDefinition, TypeDefinition annotatedTypeDefinition)
private static PropertyDefinition? FindMatchingProperty(PropertyDefinition propertyDefinition, TypeDefinition annotatedTypeDefinition)
{
return annotatedTypeDefinition.Properties.SingleOrDefault(property => EquivalenceComparers.PropertyDefinition.Equals(propertyDefinition, property));
}

private static FieldDefinition FindMatchingField(FieldDefinition fieldDefinition, TypeDefinition annotatedTypeDefinition)
private static FieldDefinition? FindMatchingField(FieldDefinition fieldDefinition, TypeDefinition annotatedTypeDefinition)
{
return annotatedTypeDefinition.Fields.SingleOrDefault(property => property.Name == fieldDefinition.Name);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<Compile Include="$(NullableAttributesPath)" Visible="false" />

<!-- Workaround for https://github.com/dotnet/wpf/issues/810 -->
<_GeneratedCodeFiles Include="$(NullableAttributesPath)" Visible="false" Condition="'$(UseWPF)' == 'true'" />
<_GeneratedCodeFiles Include="$(NullableAttributesPath)" Visible="false" Condition="'$(UseWPF)' == 'true' AND '$(IncludePackageReferencesDuringMarkupCompilation)' != 'true'" />

<!-- Make sure the source file is embedded in PDB to support Source Link -->
<EmbeddedFiles Condition="'$(DebugType)' != 'none'" Include="$(NullableAttributesPath)" />
Expand Down
30 changes: 11 additions & 19 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
version: '{build}'
image: Visual Studio 2019
image: Visual Studio 2022
configuration:
- Debug
- Release
Expand Down Expand Up @@ -30,19 +30,15 @@ test_script:
- git clean -dxf tests
- msbuild /restore tests/SingleTFM /p:TestFramework=netstandard2.1 /warnaserror /nr:false /v:m
- git clean -dxf tests
- msbuild /restore tests/SingleTFM /p:TestFramework=netcoreapp1.0 /p:DisableImplicitNuGetFallbackFolder=true /warnaserror /nr:false /v:m
- git clean -dxf tests
- msbuild /restore tests/SingleTFM /p:TestFramework=netcoreapp1.1 /p:DisableImplicitNuGetFallbackFolder=true /warnaserror /nr:false /v:m
- git clean -dxf tests
- msbuild /restore tests/SingleTFM /p:TestFramework=netcoreapp2.0 /warnaserror /nr:false /v:m
- msbuild /restore tests/SingleTFM /p:TestFramework=netcoreapp3.1 /warnaserror /nr:false /v:m
- git clean -dxf tests
- msbuild /restore tests/SingleTFM /p:TestFramework=netcoreapp2.1 /warnaserror /nr:false /v:m
- msbuild /restore tests/SingleTFM /p:TestFramework=net5.0 /warnaserror /nr:false /v:m
- git clean -dxf tests
- msbuild /restore tests/SingleTFM /p:TestFramework=netcoreapp3.0 /warnaserror /nr:false /v:m
- msbuild /restore tests/SingleTFM /p:TestFramework=net6.0 /warnaserror /nr:false /v:m
- git clean -dxf tests
- msbuild /restore tests/SingleTFM /p:TestFramework=netcoreapp3.1 /warnaserror /nr:false /v:m
- msbuild /restore tests/WPF /warnaserror /nr:false /v:m /p:IncludePackageReferencesDuringMarkupCompilation=false
- git clean -dxf tests
- msbuild /restore tests/WPF /warnaserror /nr:false /v:m
- msbuild /restore tests/WPF /warnaserror /nr:false /v:m /p:IncludePackageReferencesDuringMarkupCompilation=true

- git clean -dxf tests
- dotnet msbuild -restore tests/MultiTFM -warnaserror -nr:false -v:m
Expand All @@ -61,18 +57,14 @@ test_script:
- git clean -dxf tests
- dotnet msbuild -restore tests/SingleTFM -p:TestFramework=netstandard2.1 -warnaserror -nr:false -v:m
- git clean -dxf tests
- dotnet msbuild -restore tests/SingleTFM -p:TestFramework=netcoreapp1.0 -p:DisableImplicitNuGetFallbackFolder=true -warnaserror -nr:false -v:m
- git clean -dxf tests
- dotnet msbuild -restore tests/SingleTFM -p:TestFramework=netcoreapp1.1 -p:DisableImplicitNuGetFallbackFolder=true -warnaserror -nr:false -v:m
- git clean -dxf tests
- dotnet msbuild -restore tests/SingleTFM -p:TestFramework=netcoreapp2.0 -warnaserror -nr:false -v:m
- dotnet msbuild -restore tests/SingleTFM -p:TestFramework=netcoreapp3.1 -warnaserror -nr:false -v:m
- git clean -dxf tests
- dotnet msbuild -restore tests/SingleTFM -p:TestFramework=netcoreapp2.1 -warnaserror -nr:false -v:m
- dotnet msbuild -restore tests/SingleTFM -p:TestFramework=net5.0 -warnaserror -nr:false -v:m
- git clean -dxf tests
- dotnet msbuild -restore tests/SingleTFM -p:TestFramework=netcoreapp3.0 -warnaserror -nr:false -v:m
- dotnet msbuild -restore tests/SingleTFM -p:TestFramework=net6.0 -warnaserror -nr:false -v:m
- git clean -dxf tests
- dotnet msbuild -restore tests/SingleTFM -p:TestFramework=netcoreapp3.1 -warnaserror -nr:false -v:m
- dotnet msbuild -restore tests/WPF -warnaserror -nr:false -v:m /p:IncludePackageReferencesDuringMarkupCompilation=false
- git clean -dxf tests
- dotnet msbuild -restore tests/WPF -warnaserror -nr:false -v:m
- dotnet msbuild -restore tests/WPF -warnaserror -nr:false -v:m /p:IncludePackageReferencesDuringMarkupCompilation=true
artifacts:
- path: 'TunnelVisionLabs.ReferenceAssemblyAnnotator\**\*.nupkg'
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "3.1.100",
"version": "6.0.100",
"rollForward": "latestFeature"
}
}
9 changes: 2 additions & 7 deletions tests/MultiTFM/MultiTFM.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net35;net48;netstandard1.6;netstandard2.0;netstandard2.1;netcoreapp1.0;netcoreapp1.1;netcoreapp2.0;netcoreapp2.1;netcoreapp3.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net35;net48;netstandard1.6;netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
<LangVersion>8</LangVersion>
<Nullable>enable</Nullable>
<NoWarn>RA1000</NoWarn>
Expand All @@ -17,15 +17,10 @@
<NoWarn>$(NoWarn),CS1701</NoWarn>
</PropertyGroup>

<ItemGroup>
<!-- https://github.com/dotnet/core-sdk/issues/2022 -->
<PackageReference Condition="'$(TargetFramework)' == 'net35'" Include="jnm2.ReferenceAssemblies.net35" Version="1.0.0" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
<PackageReference Condition="'$(TargetFramework)' != 'net35'" 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.0.0]" />
<PackageDownload Include="Microsoft.NETCore.App.Ref" Version="[6.0.0]" />
</ItemGroup>

</Project>
9 changes: 2 additions & 7 deletions tests/NoDisabledWarnings/NoDisabledWarnings.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net35;net48;netstandard1.6;netstandard2.0;netstandard2.1;netcoreapp1.0;netcoreapp1.1;netcoreapp2.0;netcoreapp2.1;netcoreapp3.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net35;net48;netstandard1.6;netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
<LangVersion>8</LangVersion>
<Nullable>enable</Nullable>
<WarningsNotAsErrors>RA1000</WarningsNotAsErrors>
Expand All @@ -18,15 +18,10 @@
<WarningsNotAsErrors>$(WarningsNotAsErrors),CS1701</WarningsNotAsErrors>
</PropertyGroup>

<ItemGroup>
<!-- https://github.com/dotnet/core-sdk/issues/2022 -->
<PackageReference Condition="'$(TargetFramework)' == 'net35'" Include="jnm2.ReferenceAssemblies.net35" Version="1.0.0" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
<PackageReference Condition="'$(TargetFramework)' != 'net35'" 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.0.0]" />
<PackageDownload Include="Microsoft.NETCore.App.Ref" Version="[6.0.0]" />
</ItemGroup>

</Project>
9 changes: 2 additions & 7 deletions tests/RefVersion3.1.0/RefVersion3.1.0.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net35;net48;netstandard1.6;netstandard2.0;netstandard2.1;netcoreapp1.0;netcoreapp1.1;netcoreapp2.0;netcoreapp2.1;netcoreapp3.0;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>net35;net48;netstandard1.6;netstandard2.0;netstandard2.1;netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
<LangVersion>8</LangVersion>
<Nullable>enable</Nullable>
<NoWarn>RA1000</NoWarn>
Expand All @@ -17,15 +17,10 @@
<NoWarn>$(NoWarn),CS1701</NoWarn>
</PropertyGroup>

<ItemGroup>
<!-- https://github.com/dotnet/core-sdk/issues/2022 -->
<PackageReference Condition="'$(TargetFramework)' == 'net35'" Include="jnm2.ReferenceAssemblies.net35" Version="1.0.0" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
<PackageReference Condition="'$(TargetFramework)' != 'net35'" 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]" />
<PackageDownload Include="Microsoft.NETCore.App.Ref" Version="[6.0.0]" />
</ItemGroup>

</Project>
7 changes: 1 addition & 6 deletions tests/SingleTFM/SingleTFM.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,10 @@
<NoWarn>$(NoWarn),CS1701</NoWarn>
</PropertyGroup>

<ItemGroup>
<!-- https://github.com/dotnet/core-sdk/issues/2022 -->
<PackageReference Condition="'$(TargetFramework)' == 'net35'" Include="jnm2.ReferenceAssemblies.net35" Version="1.0.0" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
<PackageReference Condition="'$(TargetFramework)' != 'net35'" 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.0.0]" />
<PackageDownload Include="Microsoft.NETCore.App.Ref" Version="[6.0.0]" />
</ItemGroup>

</Project>
11 changes: 1 addition & 10 deletions tests/WPF/UserControl1.xaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
<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>
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"/>
8 changes: 3 additions & 5 deletions tests/WPF/WPF.csproj
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
<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>
<TargetFrameworks>net35;net48;netcoreapp3.1;net5.0-windows;net6.0-windows</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 Condition="'$(TargetFramework)' != 'net35'" 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]" />
<PackageDownload Include="Microsoft.NETCore.App.Ref" Version="[6.0.0]" />
</ItemGroup>

</Project>