diff --git a/src/SourceBuild/patches/roslyn-analyzers/0002-Fix-ImmutableCollection-analyzer-invalid-cast.patch b/src/SourceBuild/patches/roslyn-analyzers/0002-Fix-ImmutableCollection-analyzer-invalid-cast.patch new file mode 100644 index 000000000000..f60ae44b923b --- /dev/null +++ b/src/SourceBuild/patches/roslyn-analyzers/0002-Fix-ImmutableCollection-analyzer-invalid-cast.patch @@ -0,0 +1,26 @@ +From 6f4d85b6ffd64190045ab29ba2903628788b8dc5 Mon Sep 17 00:00:00 2001 +From: Matt Thalman +Date: Tue, 14 Feb 2023 10:59:29 -0600 +Subject: [PATCH] Fix ImmutableCollection analyzer invalid cast + +Backport: https://github.com/dotnet/roslyn-analyzers/pull/6476 +--- + ...tCallToImmutableCollectionOnAnImmutableCollectionValue.cs | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/ImmutableCollections/DoNotCallToImmutableCollectionOnAnImmutableCollectionValue.cs b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/ImmutableCollections/DoNotCallToImmutableCollectionOnAnImmutableCollectionValue.cs +index 9e6cc03404..ee1151a1fa 100644 +--- a/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/ImmutableCollections/DoNotCallToImmutableCollectionOnAnImmutableCollectionValue.cs ++++ b/src/NetAnalyzers/Core/Microsoft.NetCore.Analyzers/ImmutableCollections/DoNotCallToImmutableCollectionOnAnImmutableCollectionValue.cs +@@ -91,9 +91,8 @@ public override void Initialize(AnalysisContext context) + return; + } + +- var receiverType = (INamedTypeSymbol?)invocation.GetReceiverType(operationContext.Compilation, beforeConversion: true, cancellationToken: operationContext.CancellationToken); +- if (receiverType != null && +- receiverType.DerivesFromOrImplementsAnyConstructionOf(immutableCollectionType)) ++ if (invocation.GetReceiverType(operationContext.Compilation, beforeConversion: true, cancellationToken: operationContext.CancellationToken) is INamedTypeSymbol receiverType ++ && receiverType.DerivesFromOrImplementsAnyConstructionOf(immutableCollectionType)) + { + operationContext.ReportDiagnostic( + invocation.CreateDiagnostic( diff --git a/src/SourceBuild/patches/roslyn/0001-Remove-Roslyns-IdeBenchmarks-tool-from-being-source-.patch b/src/SourceBuild/patches/roslyn/0001-Remove-Roslyns-IdeBenchmarks-tool-from-being-source-.patch new file mode 100644 index 000000000000..eb15c90f683a --- /dev/null +++ b/src/SourceBuild/patches/roslyn/0001-Remove-Roslyns-IdeBenchmarks-tool-from-being-source-.patch @@ -0,0 +1,42 @@ +From 2bcb8ebb4f54950d08b7b8d2cc137879423ae9b0 Mon Sep 17 00:00:00 2001 +From: Matt Thalman +Date: Tue, 14 Feb 2023 10:55:15 -0600 +Subject: [PATCH] Remove Roslyn's IdeBenchmarks tool from being source-built + +Backport: https://github.com/dotnet/source-build/issues/1736 +--- + Roslyn.sln | 7 ------- + 1 file changed, 7 deletions(-) + +diff --git a/Roslyn.sln b/Roslyn.sln +index 4070ee47d9..3764ff5772 100644 +--- a/Roslyn.sln ++++ b/Roslyn.sln +@@ -386,8 +386,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.Lang + EndProject + Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.LanguageServices.LiveShare.UnitTests", "src\VisualStudio\LiveShare\Test\Microsoft.VisualStudio.LanguageServices.LiveShare.UnitTests.csproj", "{CE7F7553-DB2D-4839-92E3-F042E4261B4E}" + EndProject +-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IdeBenchmarks", "src\Tools\IdeBenchmarks\IdeBenchmarks.csproj", "{FF38E9C9-7A25-44F0-B2C4-24C9BFD6A8F6}" +-EndProject + Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{157EA250-2F28-4948-A8F2-D58EAEA05DC8}" + ProjectSection(SolutionItems) = preProject + .editorconfig = .editorconfig +@@ -1109,10 +1107,6 @@ Global + {CE7F7553-DB2D-4839-92E3-F042E4261B4E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CE7F7553-DB2D-4839-92E3-F042E4261B4E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CE7F7553-DB2D-4839-92E3-F042E4261B4E}.Release|Any CPU.Build.0 = Release|Any CPU +- {FF38E9C9-7A25-44F0-B2C4-24C9BFD6A8F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU +- {FF38E9C9-7A25-44F0-B2C4-24C9BFD6A8F6}.Debug|Any CPU.Build.0 = Debug|Any CPU +- {FF38E9C9-7A25-44F0-B2C4-24C9BFD6A8F6}.Release|Any CPU.ActiveCfg = Release|Any CPU +- {FF38E9C9-7A25-44F0-B2C4-24C9BFD6A8F6}.Release|Any CPU.Build.0 = Release|Any CPU + {D55FB2BD-CC9E-454B-9654-94AF5D910BF7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D55FB2BD-CC9E-454B-9654-94AF5D910BF7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D55FB2BD-CC9E-454B-9654-94AF5D910BF7}.Release|Any CPU.ActiveCfg = Release|Any CPU +@@ -1451,7 +1445,6 @@ Global + {FC32EF16-31B1-47B3-B625-A80933CB3F29} = {8977A560-45C2-4EC2-A849-97335B382C74} + {453C8E28-81D4-431E-BFB0-F3D413346E51} = {8DBA5174-B0AA-4561-82B1-A46607697753} + {CE7F7553-DB2D-4839-92E3-F042E4261B4E} = {8DBA5174-B0AA-4561-82B1-A46607697753} +- {FF38E9C9-7A25-44F0-B2C4-24C9BFD6A8F6} = {FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC} + {D55FB2BD-CC9E-454B-9654-94AF5D910BF7} = {FD0FAF5F-1DED-485C-99FA-84B97F3A8EEC} + {B9899CF1-E0EB-4599-9E24-6939A04B4979} = {3E5FE3DB-45F7-4D83-9097-8F05D3B3AEC6} + {D15BF03E-04ED-4BEE-A72B-7620F541F4E2} = {3E5FE3DB-45F7-4D83-9097-8F05D3B3AEC6}