From d622283564cdbfa03f9d3171668cd69fc36d458a Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Fri, 9 Dec 2022 13:34:40 +0200 Subject: [PATCH 1/4] Use ReferenceAssemblies.Net.Net70 --- NuGet.config | 1 - .../Microsoft.CodeAnalysis.NetAnalyzers.UnitTests.csproj | 3 --- .../InteropServices/DisableRuntimeMarshallingTests.cs | 6 ++---- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/NuGet.config b/NuGet.config index 5f02aea34e..4e1dd211a2 100644 --- a/NuGet.config +++ b/NuGet.config @@ -4,7 +4,6 @@ - diff --git a/src/NetAnalyzers/UnitTests/Microsoft.CodeAnalysis.NetAnalyzers.UnitTests.csproj b/src/NetAnalyzers/UnitTests/Microsoft.CodeAnalysis.NetAnalyzers.UnitTests.csproj index ffdeeeacc1..058b1699e5 100644 --- a/src/NetAnalyzers/UnitTests/Microsoft.CodeAnalysis.NetAnalyzers.UnitTests.csproj +++ b/src/NetAnalyzers/UnitTests/Microsoft.CodeAnalysis.NetAnalyzers.UnitTests.csproj @@ -5,9 +5,6 @@ $(DefineConstants),NET_ANALYZERS_TEST true - - - diff --git a/src/NetAnalyzers/UnitTests/Microsoft.NetCore.Analyzers/InteropServices/DisableRuntimeMarshallingTests.cs b/src/NetAnalyzers/UnitTests/Microsoft.NetCore.Analyzers/InteropServices/DisableRuntimeMarshallingTests.cs index 011df8a78c..ee8f393ba2 100644 --- a/src/NetAnalyzers/UnitTests/Microsoft.NetCore.Analyzers/InteropServices/DisableRuntimeMarshallingTests.cs +++ b/src/NetAnalyzers/UnitTests/Microsoft.NetCore.Analyzers/InteropServices/DisableRuntimeMarshallingTests.cs @@ -1613,8 +1613,7 @@ private static async Task VerifyCSAnalyzerWithAdditionalSourceAsync(string sourc var test = new VerifyCS.Test { LanguageVersion = LanguageVersion.CSharp9, - ReferenceAssemblies = new ReferenceAssemblies("net7.0", new PackageIdentity("Microsoft.NETCore.App.Ref", "7.0.0-preview.1.22075.6"), Path.Combine("ref", "net7.0")) - .WithNuGetConfigFilePath(Path.Combine(Path.GetDirectoryName(typeof(DisableRuntimeMarshallingTests).Assembly.Location), "NuGet.config")), + ReferenceAssemblies = ReferenceAssemblies.Net.Net70, TestCode = source, MarkupOptions = MarkupOptions.UseFirstDescriptor }; @@ -1628,8 +1627,7 @@ private static async Task VerifyCSAnalyzerWithAdditionalAssemblyAsync(string sou var test = new VerifyCS.Test { LanguageVersion = LanguageVersion.CSharp9, - ReferenceAssemblies = new ReferenceAssemblies("net7.0", new PackageIdentity("Microsoft.NETCore.App.Ref", "7.0.0-preview.1.22075.6"), Path.Combine("ref", "net7.0")) - .WithNuGetConfigFilePath(Path.Combine(Path.GetDirectoryName(typeof(DisableRuntimeMarshallingTests).Assembly.Location), "NuGet.config")), + ReferenceAssemblies = ReferenceAssemblies.Net.Net70, TestCode = source, MarkupOptions = MarkupOptions.UseFirstDescriptor }; From af0ab1253598d7658cf283e64f0a907bb2007d47 Mon Sep 17 00:00:00 2001 From: Youssef Victor Date: Fri, 9 Dec 2022 14:08:24 +0200 Subject: [PATCH 2/4] Revert --- NuGet.config | 1 + 1 file changed, 1 insertion(+) diff --git a/NuGet.config b/NuGet.config index 4e1dd211a2..5f02aea34e 100644 --- a/NuGet.config +++ b/NuGet.config @@ -4,6 +4,7 @@ + From 04e66a6a1ed2af32368ff0c5512a0900fe950002 Mon Sep 17 00:00:00 2001 From: Youssef Victor Date: Fri, 9 Dec 2022 16:33:37 +0200 Subject: [PATCH 3/4] Fix --- .../InteropServices/DisableRuntimeMarshallingTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/NetAnalyzers/UnitTests/Microsoft.NetCore.Analyzers/InteropServices/DisableRuntimeMarshallingTests.cs b/src/NetAnalyzers/UnitTests/Microsoft.NetCore.Analyzers/InteropServices/DisableRuntimeMarshallingTests.cs index ee8f393ba2..7d52fa710b 100644 --- a/src/NetAnalyzers/UnitTests/Microsoft.NetCore.Analyzers/InteropServices/DisableRuntimeMarshallingTests.cs +++ b/src/NetAnalyzers/UnitTests/Microsoft.NetCore.Analyzers/InteropServices/DisableRuntimeMarshallingTests.cs @@ -1622,6 +1622,7 @@ private static async Task VerifyCSAnalyzerWithAdditionalSourceAsync(string sourc await test.RunAsync(); } + private static async Task VerifyCSAnalyzerWithAdditionalAssemblyAsync(string source, string additionalReferencedAssemblySource) { var test = new VerifyCS.Test @@ -1654,8 +1655,7 @@ private static async Task VerifyCSCodeFixAsync(string source, string codeFix, bo var test = new VerifyCS.Test { LanguageVersion = LanguageVersion.CSharp9, - ReferenceAssemblies = new ReferenceAssemblies("net7.0", new PackageIdentity("Microsoft.NETCore.App.Ref", "7.0.0-preview.1.22075.6"), Path.Combine("ref", "net7.0")) - .WithNuGetConfigFilePath(Path.Combine(Path.GetDirectoryName(typeof(DisableRuntimeMarshallingTests).Assembly.Location), "NuGet.config")), + ReferenceAssemblies = ReferenceAssemblies.Net.Net70, TestCode = source, FixedCode = codeFix, SolutionTransforms = From 951c3774e3e4e65fe96dbdf17af2a60429a2fcdf Mon Sep 17 00:00:00 2001 From: Youssef Victor Date: Fri, 9 Dec 2022 17:02:49 +0200 Subject: [PATCH 4/4] Update DisableRuntimeMarshallingTests.cs --- .../InteropServices/DisableRuntimeMarshallingTests.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/NetAnalyzers/UnitTests/Microsoft.NetCore.Analyzers/InteropServices/DisableRuntimeMarshallingTests.cs b/src/NetAnalyzers/UnitTests/Microsoft.NetCore.Analyzers/InteropServices/DisableRuntimeMarshallingTests.cs index 7d52fa710b..4c08c17593 100644 --- a/src/NetAnalyzers/UnitTests/Microsoft.NetCore.Analyzers/InteropServices/DisableRuntimeMarshallingTests.cs +++ b/src/NetAnalyzers/UnitTests/Microsoft.NetCore.Analyzers/InteropServices/DisableRuntimeMarshallingTests.cs @@ -1682,8 +1682,7 @@ private static async Task VerifyVBAnalyzerAsync(string source) { var test = new VerifyVB.Test { - ReferenceAssemblies = new ReferenceAssemblies("net7.0", new PackageIdentity("Microsoft.NETCore.App.Ref", "7.0.0-preview.1.22075.6"), Path.Combine("ref", "net7.0")) - .WithNuGetConfigFilePath(Path.Combine(Path.GetDirectoryName(typeof(DisableRuntimeMarshallingTests).Assembly.Location), "NuGet.config")), + ReferenceAssemblies = ReferenceAssemblies.Net.Net70, TestCode = source, FixedCode = source };