diff --git a/.github/instructions/IDE.instructions.md b/.github/instructions/IDE.instructions.md
index 12a8150f95ab1..b96a454a7d689 100644
--- a/.github/instructions/IDE.instructions.md
+++ b/.github/instructions/IDE.instructions.md
@@ -15,6 +15,7 @@ Roslyn uses a **layered service architecture** built on MEF (Managed Extensibili
- **LanguageServer** (`src/LanguageServer/`): Shared LSP protocol implementation and Roslyn LSP executable (`roslyn-language-server`)
- **EditorFeatures** (`src/EditorFeatures/`): VS Editor integration and text manipulation
- **VisualStudio** (`src/VisualStudio/`): Visual Studio-specific implementations
+- **VisualStudio integration-test harness** (`src/VisualStudio/IntegrationTest/Harness/`): shared integration-test infrastructure
- **EditorConfig templates** (`src/VisualStudio/EditorConfig/`): item templates, generation wizard, context-menu command, VSIX projects, and Visual Studio insertion setup
- The setup insertion component is `Templates.Editorconfig.Setup`, but its SWR package identity must remain `Templates.Editorconfig.SolutionFile.Setup` because existing Visual Studio template packages depend on that ID.
diff --git a/.github/memory/CONVENTIONS.md b/.github/memory/CONVENTIONS.md
index a02d617d3b403..03ad842b25712 100644
--- a/.github/memory/CONVENTIONS.md
+++ b/.github/memory/CONVENTIONS.md
@@ -47,6 +47,12 @@ var symbolInfo = semanticModel.GetSymbolInfo(expression, cancellationToken);
- Judge change size by cognitive load and validation boundaries, not an arbitrary line count; generated and mechanical updates may be large while still representing one focused change.
- A change is complete only after applicable formatting, analyzers, affected builds, targeted tests, generated/resource/API updates, final diff review, and documentation freshness work are complete. The canonical ordered checklist is the **Definition of Done** in `.github/copilot-instructions.md`.
+### CodeAnalysis testing-library dependencies
+
+- Compatible internal repository build and test projects reference the testing-library projects under `src/RoslynSdk/Microsoft.CodeAnalysis.Testing` so source changes are exercised directly.
+- The testing-library projects do not copy NuGet runtime dependencies into their .NET Framework output directories. Final test projects resolve and copy the unified dependency graph.
+- Roslyn SDK samples and Visual Studio SDK project templates retain NuGet package references because they model standalone consumers outside the repository source graph.
+
## Patterns Explicitly Avoided
- **No `TODO` or `TODO2` comments** — CI correctness leg flags `TODO`. Track follow-up work as a GitHub issue and link it in code (e.g. `// https://github.com/dotnet/roslyn/issues/NNNN`). Existing `TODO2` markers are a frozen baseline from when enforcement started, not a pattern to follow.
diff --git a/.github/memory/FILE_MAP.md b/.github/memory/FILE_MAP.md
index bc0ecce9f8747..db070369037ee 100644
--- a/.github/memory/FILE_MAP.md
+++ b/.github/memory/FILE_MAP.md
@@ -23,7 +23,7 @@ This file is a **top-level map only**. For per-area directory detail, read the m
| `Features/`, `EditorFeatures/` | ide | IDE feature logic and editor integration. |
| `Analyzers/`, `CodeStyle/` | ide | IDE0xxx code-style analyzers & fixes. |
| `LanguageServer/` | ide | LSP server. |
-| `VisualStudio/` | ide | VS language services, UI, and EditorConfig template/wizard/command packaging under `EditorConfig/`. |
+| `VisualStudio/` | ide | VS language services, UI, EditorConfig template/wizard/command packaging under `EditorConfig/`, and integration-test infrastructure under `IntegrationTest/`. |
| `Razor/src/` | razor | Razor compiler + tooling (own sub-tree layout). |
| `Scripting/`, `Interactive/` | — | C#/VB scripting engine and REPL. |
| `RoslynAnalyzers/` | — | Shipping `Microsoft.CodeAnalysis.*` analyzer packages. |
diff --git a/.github/memory/TESTING_STRATEGY.md b/.github/memory/TESTING_STRATEGY.md
index aa0c0f49770b5..eb448bc9826d7 100644
--- a/.github/memory/TESTING_STRATEGY.md
+++ b/.github/memory/TESTING_STRATEGY.md
@@ -26,6 +26,11 @@ Frameworks: xUnit with Roslyn test utilities.
- Prefer raw string literals (`"""..."""`) over verbatim strings for test source code.
- Keep tests focused: use `.Single()` rather than asserting a count then indexing.
+- Analyzer testing-library tests should use `ReferenceAssemblies.Default` for
+ the stable .NET Core 3.1 reference surface. Use an explicit
+ `ReferenceAssemblies` value, such as `ReferenceAssemblies.Net.Net100`, when
+ the scenario intentionally depends on a newer or specific framework API
+ surface.
- For issue-linked changes, add a `WorkItem` attribute next to the test
attribute, e.g. `[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/1234")]`
or `[Theory, WorkItem("https://github.com/dotnet/roslyn/issues/1234")]`.
diff --git a/eng/Packages.props b/eng/Packages.props
index a47c77b87eb1f..6f1eb97d5afb4 100644
--- a/eng/Packages.props
+++ b/eng/Packages.props
@@ -1,7 +1,6 @@
- 1.1.3-beta1.26059.1
<_BasicReferenceAssembliesVersion>1.8.8
5.9.0
@@ -288,13 +287,7 @@
-
-
-
-
-
-
@@ -350,8 +343,6 @@
vs-extension-testing
-->
-
-
diff --git a/src/Analyzers/CSharp/Tests/RemoveUnnecessaryCast/RemoveUnnecessaryCastTests.cs b/src/Analyzers/CSharp/Tests/RemoveUnnecessaryCast/RemoveUnnecessaryCastTests.cs
index c1a03e26f0954..b76a4effb16e8 100644
--- a/src/Analyzers/CSharp/Tests/RemoveUnnecessaryCast/RemoveUnnecessaryCastTests.cs
+++ b/src/Analyzers/CSharp/Tests/RemoveUnnecessaryCast/RemoveUnnecessaryCastTests.cs
@@ -13668,4 +13668,34 @@ static void Main(string[] args)
LanguageVersion = LanguageVersion.CSharp14,
ReferenceAssemblies = ReferenceAssemblies.Net.Net90,
}.RunAsync();
+
+#if NET
+ [Fact]
+ public Task RemoveNativeIntegerCastsWithNet100References()
+ => new VerifyCS.Test
+ {
+ ReferenceAssemblies = ReferenceAssemblies.Net.Net100,
+ TestCode = """
+ using System;
+
+ public class C
+ {
+ public nuint FromIntPtr(IntPtr x) => (nuint)[|(nint)|]x;
+ public int ToInt(IntPtr x) => (int)[|(nint)|]x;
+ public nint FromUIntPtr(UIntPtr x) => (nint)[|(nuint)|]x;
+ }
+ """,
+ FixedCode = """
+ using System;
+
+ public class C
+ {
+ public nuint FromIntPtr(IntPtr x) => (nuint)x;
+ public int ToInt(IntPtr x) => (int)x;
+ public nint FromUIntPtr(UIntPtr x) => (nint)x;
+ }
+ """,
+ LanguageVersion = LanguageVersion.CSharp9,
+ }.RunAsync();
+#endif
}
diff --git a/src/CodeStyle/CSharp/Tests/Microsoft.CodeAnalysis.CSharp.CodeStyle.UnitTests.csproj b/src/CodeStyle/CSharp/Tests/Microsoft.CodeAnalysis.CSharp.CodeStyle.UnitTests.csproj
index 8ba99a0fbfa50..6f87d4e66a2fe 100644
--- a/src/CodeStyle/CSharp/Tests/Microsoft.CodeAnalysis.CSharp.CodeStyle.UnitTests.csproj
+++ b/src/CodeStyle/CSharp/Tests/Microsoft.CodeAnalysis.CSharp.CodeStyle.UnitTests.csproj
@@ -14,7 +14,6 @@
-
@@ -24,6 +23,7 @@
+
diff --git a/src/CodeStyle/Core/Tests/UnitTestUtilities/Microsoft.CodeAnalysis.CodeStyle.UnitTestUtilities.csproj b/src/CodeStyle/Core/Tests/UnitTestUtilities/Microsoft.CodeAnalysis.CodeStyle.UnitTestUtilities.csproj
index 45847a5466ee8..2407f394aad88 100644
--- a/src/CodeStyle/Core/Tests/UnitTestUtilities/Microsoft.CodeAnalysis.CodeStyle.UnitTestUtilities.csproj
+++ b/src/CodeStyle/Core/Tests/UnitTestUtilities/Microsoft.CodeAnalysis.CodeStyle.UnitTestUtilities.csproj
@@ -37,11 +37,11 @@
-
-
-
-
-
+
+
+
+
+
diff --git a/src/CodeStyle/VisualBasic/Tests/Microsoft.CodeAnalysis.VisualBasic.CodeStyle.UnitTests.vbproj b/src/CodeStyle/VisualBasic/Tests/Microsoft.CodeAnalysis.VisualBasic.CodeStyle.UnitTests.vbproj
index ccbbabaa7aa1c..1530dcc0a6c9b 100644
--- a/src/CodeStyle/VisualBasic/Tests/Microsoft.CodeAnalysis.VisualBasic.CodeStyle.UnitTests.vbproj
+++ b/src/CodeStyle/VisualBasic/Tests/Microsoft.CodeAnalysis.VisualBasic.CodeStyle.UnitTests.vbproj
@@ -14,14 +14,12 @@
-
-
-
+
diff --git a/src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer.ProcessHost.UnitTests/Microsoft.CodeAnalysis.LanguageServer.ProcessHost.UnitTests.csproj b/src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer.ProcessHost.UnitTests/Microsoft.CodeAnalysis.LanguageServer.ProcessHost.UnitTests.csproj
index 3da8f26d5ace1..ce5943f87ff0f 100644
--- a/src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer.ProcessHost.UnitTests/Microsoft.CodeAnalysis.LanguageServer.ProcessHost.UnitTests.csproj
+++ b/src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer.ProcessHost.UnitTests/Microsoft.CodeAnalysis.LanguageServer.ProcessHost.UnitTests.csproj
@@ -25,10 +25,6 @@
-
-
-
-
-
+
diff --git a/src/Razor/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.UnitTests/Microsoft.NET.Sdk.Razor.SourceGenerators.UnitTests.csproj b/src/Razor/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.UnitTests/Microsoft.NET.Sdk.Razor.SourceGenerators.UnitTests.csproj
index cae0919ef6b72..bea6ddf5f2a35 100644
--- a/src/Razor/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.UnitTests/Microsoft.NET.Sdk.Razor.SourceGenerators.UnitTests.csproj
+++ b/src/Razor/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.UnitTests/Microsoft.NET.Sdk.Razor.SourceGenerators.UnitTests.csproj
@@ -33,7 +33,7 @@
-
+
diff --git a/src/Razor/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Cohosting/Microsoft.AspNetCore.Razor.Test.Common.Cohosting.csproj b/src/Razor/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Cohosting/Microsoft.AspNetCore.Razor.Test.Common.Cohosting.csproj
index 7a284d352ff9d..c3d851e406b15 100644
--- a/src/Razor/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Cohosting/Microsoft.AspNetCore.Razor.Test.Common.Cohosting.csproj
+++ b/src/Razor/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Cohosting/Microsoft.AspNetCore.Razor.Test.Common.Cohosting.csproj
@@ -33,7 +33,6 @@
-
diff --git a/src/Razor/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Microsoft.AspNetCore.Razor.Test.Common.Tooling.csproj b/src/Razor/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Microsoft.AspNetCore.Razor.Test.Common.Tooling.csproj
index e8e0f8d75a900..5426c5e6c1010 100644
--- a/src/Razor/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Microsoft.AspNetCore.Razor.Test.Common.Tooling.csproj
+++ b/src/Razor/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Microsoft.AspNetCore.Razor.Test.Common.Tooling.csproj
@@ -44,7 +44,7 @@
-
+
diff --git a/src/RoslynAnalyzers/Microsoft.CodeAnalysis.ResxSourceGenerator/Microsoft.CodeAnalysis.ResxSourceGenerator.UnitTests/Microsoft.CodeAnalysis.ResxSourceGenerator.UnitTests.csproj b/src/RoslynAnalyzers/Microsoft.CodeAnalysis.ResxSourceGenerator/Microsoft.CodeAnalysis.ResxSourceGenerator.UnitTests/Microsoft.CodeAnalysis.ResxSourceGenerator.UnitTests.csproj
index 1a1d829966613..1a93b45f5f5f0 100644
--- a/src/RoslynAnalyzers/Microsoft.CodeAnalysis.ResxSourceGenerator/Microsoft.CodeAnalysis.ResxSourceGenerator.UnitTests/Microsoft.CodeAnalysis.ResxSourceGenerator.UnitTests.csproj
+++ b/src/RoslynAnalyzers/Microsoft.CodeAnalysis.ResxSourceGenerator/Microsoft.CodeAnalysis.ResxSourceGenerator.UnitTests/Microsoft.CodeAnalysis.ResxSourceGenerator.UnitTests.csproj
@@ -18,20 +18,18 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
diff --git a/src/RoslynAnalyzers/PerformanceSensitiveAnalyzers/UnitTests/CallSiteImplicitAllocationAnalyzerTests.cs b/src/RoslynAnalyzers/PerformanceSensitiveAnalyzers/UnitTests/CallSiteImplicitAllocationAnalyzerTests.cs
index 5ed9549069443..b7f57d8a9ca0b 100644
--- a/src/RoslynAnalyzers/PerformanceSensitiveAnalyzers/UnitTests/CallSiteImplicitAllocationAnalyzerTests.cs
+++ b/src/RoslynAnalyzers/PerformanceSensitiveAnalyzers/UnitTests/CallSiteImplicitAllocationAnalyzerTests.cs
@@ -19,45 +19,56 @@ public sealed class CallSiteImplicitAllocationAnalyzerTests
{
[Fact]
public Task CallSiteImplicitAllocation_ParamAsync()
- => VerifyCS.VerifyAnalyzerAsync("""
- using System;
- using Roslyn.Utilities;
-
- public class MyClass
+ => new VerifyCS.Test
+ {
+ ReferenceAssemblies = ReferenceAssemblies.Net.Net100,
+ TestState =
{
- [PerformanceSensitive("uri")]
- public void Testing()
+ Sources =
{
+ """
+ using System;
+ using Roslyn.Utilities;
+
+ public class MyClass
+ {
+ [PerformanceSensitive("uri")]
+ public void Testing()
+ {
- Params(); //no allocation, because compiler will implicitly substitute Array.Empty()
- Params(1, 2);
- Params(new [] { 1, 2}); // explicit, so no warning
- ParamsWithObjects(new [] { 1, 2}); // explicit, but converted to objects, so stil la warning?!
+ Params(); //no allocation, because compiler will implicitly substitute Array.Empty()
+ Params(1, 2);
+ Params(new [] { 1, 2}); // explicit, so no warning
+ ParamsWithObjects(new [] { 1, 2}); // explicit, but converted to objects, so stil la warning?!
- // Only 4 args and above use the params overload of String.Format
- var test = String.Format("Testing {0}, {1}, {2}, {3}", 1, "blah", 2.0m, 'c');
- }
+ // String.Format uses the params span overload, so it does not allocate an array.
+ var test = String.Format("Testing {0}, {1}, {2}, {3}", 1, "blah", 2.0m, 'c');
+ }
- public void Params(params int[] args)
- {
- }
+ public void Params(params int[] args)
+ {
+ }
- public void ParamsWithObjects(params object[] args)
+ public void ParamsWithObjects(params object[] args)
+ {
+ }
+ }
+ """,
+ ("PerformanceSensitiveAttribute.cs", VerifyCS.PerformanceSensitiveAttributeSource),
+ },
+ ExpectedDiagnostics =
{
- }
- }
- """,
- // Test0.cs(11,9): warning HAA0101: This call site is calling into a function with a 'params' parameter. This results in an array allocation
+ // Test0.cs(11,9): warning HAA0101: This call site is calling into a function with a 'params' parameter. This results in an array allocation
#pragma warning disable RS0030 // Do not use banned APIs
- VerifyCS.Diagnostic(CallSiteImplicitAllocationAnalyzer.ParamsParameterRule).WithLocation(11, 9),
+ VerifyCS.Diagnostic(CallSiteImplicitAllocationAnalyzer.ParamsParameterRule).WithLocation(11, 9),
#pragma warning restore RS0030 // Do not use banned APIs
- // Test0.cs(13,9): warning HAA0101: This call site is calling into a function with a 'params' parameter. This results in an array allocation
+ // Test0.cs(13,9): warning HAA0101: This call site is calling into a function with a 'params' parameter. This results in an array allocation
#pragma warning disable RS0030 // Do not use banned APIs
- VerifyCS.Diagnostic(CallSiteImplicitAllocationAnalyzer.ParamsParameterRule).WithLocation(13, 9),
+ VerifyCS.Diagnostic(CallSiteImplicitAllocationAnalyzer.ParamsParameterRule).WithLocation(13, 9),
#pragma warning restore RS0030 // Do not use banned APIs
- // Test0.cs(16,20): warning HAA0101: This call site is calling into a function with a 'params' parameter. This results in an array allocation
-#pragma warning disable RS0030 // Do not use banned APIs
- VerifyCS.Diagnostic(CallSiteImplicitAllocationAnalyzer.ParamsParameterRule).WithLocation(16, 20));
+ },
+ },
+ }.RunAsync();
[Fact, WorkItem(3272, "https://github.com/dotnet/roslyn-analyzers/issues/3272")]
public Task EmptyParamsWithNetFramework45Async()
@@ -204,4 +215,37 @@ public void SomeMethod()
// Test0.cs(12,9): warning HAA0102: Non-overridden virtual method call on a value type adds a boxing or constrained instruction
#pragma warning disable RS0030 // Do not use banned APIs
VerifyCS.Diagnostic(CallSiteImplicitAllocationAnalyzer.ValueTypeNonOverridenCallRule).WithLocation(11, 9));
+
+ [Fact]
+ public Task StringFormatWithFourArgumentsAllocatesParamsArrayWithNetCoreApp31Async()
+ => new VerifyCS.Test
+ {
+ ReferenceAssemblies = ReferenceAssemblies.NetCore.NetCoreApp31,
+ TestState =
+ {
+ Sources =
+ {
+ """
+ using System;
+ using Roslyn.Utilities;
+
+ public class MyClass
+ {
+ [PerformanceSensitive("uri")]
+ public void Testing()
+ {
+ var test = {|#0:String.Format("Testing {0}, {1}, {2}, {3}", 1, "blah", 2.0m, 'c')|};
+ }
+ }
+ """,
+ ("PerformanceSensitiveAttribute.cs", VerifyCS.PerformanceSensitiveAttributeSource),
+ },
+ ExpectedDiagnostics =
+ {
+#pragma warning disable RS0030 // Do not use banned APIs
+ VerifyCS.Diagnostic(CallSiteImplicitAllocationAnalyzer.ParamsParameterRule).WithLocation(0),
+#pragma warning restore RS0030 // Do not use banned APIs
+ },
+ },
+ }.RunAsync();
}
diff --git a/src/RoslynAnalyzers/PublicApiAnalyzers/UnitTests/DeclarePublicAPIAnalyzerTestsBase.cs b/src/RoslynAnalyzers/PublicApiAnalyzers/UnitTests/DeclarePublicAPIAnalyzerTestsBase.cs
index ecd38b0b0c72e..2cc1358034653 100644
--- a/src/RoslynAnalyzers/PublicApiAnalyzers/UnitTests/DeclarePublicAPIAnalyzerTestsBase.cs
+++ b/src/RoslynAnalyzers/PublicApiAnalyzers/UnitTests/DeclarePublicAPIAnalyzerTestsBase.cs
@@ -1009,52 +1009,66 @@ public async Task TypeForwardsAreProcessed2Async()
return;
}
-#if NETCOREAPP
- var containingAssembly = "System.Runtime.Extensions";
- const string NonNullSuffix = "!";
- const string NullableSuffix = "?";
-#else
- var containingAssembly = "mscorlib";
- const string NonNullSuffix = "";
- const string NullableSuffix = "";
-#endif
- string shippedText = $"""
-
- System.StringComparer (forwarded, contained in {containingAssembly})
- static System.StringComparer.InvariantCulture.get -> System.StringComparer{NonNullSuffix} (forwarded, contained in {containingAssembly})
- static System.StringComparer.InvariantCultureIgnoreCase.get -> System.StringComparer{NonNullSuffix} (forwarded, contained in {containingAssembly})
- static System.StringComparer.CurrentCulture.get -> System.StringComparer{NonNullSuffix} (forwarded, contained in {containingAssembly})
- static System.StringComparer.CurrentCultureIgnoreCase.get -> System.StringComparer{NonNullSuffix} (forwarded, contained in {containingAssembly})
- static System.StringComparer.Ordinal.get -> System.StringComparer{NonNullSuffix} (forwarded, contained in {containingAssembly})
- static System.StringComparer.OrdinalIgnoreCase.get -> System.StringComparer{NonNullSuffix} (forwarded, contained in {containingAssembly})
- static System.StringComparer.Create(System.Globalization.CultureInfo{NonNullSuffix} culture, bool ignoreCase) -> System.StringComparer{NonNullSuffix} (forwarded, contained in {containingAssembly})
- System.StringComparer.Compare(object{NullableSuffix} x, object{NullableSuffix} y) -> int (forwarded, contained in {containingAssembly})
- System.StringComparer.Equals(object{NullableSuffix} x, object{NullableSuffix} y) -> bool (forwarded, contained in {containingAssembly})
- System.StringComparer.GetHashCode(object{NonNullSuffix} obj) -> int (forwarded, contained in {containingAssembly})
- abstract System.StringComparer.Compare(string{NullableSuffix} x, string{NullableSuffix} y) -> int (forwarded, contained in {containingAssembly})
- abstract System.StringComparer.Equals(string{NullableSuffix} x, string{NullableSuffix} y) -> bool (forwarded, contained in {containingAssembly})
- abstract System.StringComparer.GetHashCode(string{NonNullSuffix} obj) -> int (forwarded, contained in {containingAssembly})
- System.StringComparer.StringComparer() -> void (forwarded, contained in {containingAssembly})
+ const string forwardedTypeAssemblyName = "ForwardedTypeAssembly";
+ const string forwardedTypeSource = """
- """;
+ namespace TypeForwarding
+ {
+ public static class ForwardedType
+ {
+ public static int GetValue() => 0;
+ }
+ }
-#if NETCOREAPP
- shippedText = $"""
+ """;
+ const string forwardedTypeApi = """
- #nullable enable
- {shippedText}
- static System.StringComparer.Create(System.Globalization.CultureInfo{NonNullSuffix} culture, System.Globalization.CompareOptions options) -> System.StringComparer{NonNullSuffix} (forwarded, contained in {containingAssembly})
- static System.StringComparer.FromComparison(System.StringComparison comparisonType) -> System.StringComparer{NonNullSuffix} (forwarded, contained in {containingAssembly})
+ TypeForwarding.ForwardedType
+ static TypeForwarding.ForwardedType.GetValue() -> int
""";
-#endif
+ var test = new CSharpCodeFixTest
+ {
+ ReferenceAssemblies = ReferenceAssemblies.Default,
+ TestState =
+ {
+ Sources =
+ {
+ """
- await VerifyCSharpAsync("""
+ [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(TypeForwarding.ForwardedType))]
+
+ """,
+ },
+ AdditionalFiles =
+ {
+ (ShippedFileName, """
- [assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.StringComparer))]
+ TypeForwarding.ForwardedType (forwarded, contained in ForwardedTypeAssembly)
+ static TypeForwarding.ForwardedType.GetValue() -> int (forwarded, contained in ForwardedTypeAssembly)
- """, shippedText, $@"");
+ """),
+ (UnshippedFileName, ""),
+ },
+ AdditionalProjects =
+ {
+ [forwardedTypeAssemblyName] =
+ {
+ Sources = { forwardedTypeSource },
+ AdditionalFiles =
+ {
+ (ShippedFileName, forwardedTypeApi),
+ (UnshippedFileName, ""),
+ },
+ },
+ },
+ AdditionalProjectReferences = { forwardedTypeAssemblyName },
+ },
+ };
+
+ test.DisabledDiagnostics.AddRange(DisabledDiagnostics);
+ await test.RunAsync();
}
[Fact, WorkItem(1192, "https://github.com/dotnet/roslyn-analyzers/issues/1192")]
diff --git a/src/RoslynAnalyzers/Roslyn.Diagnostics.Analyzers/UnitTests/CSharpDoNotUseDebugAssertForInterpolatedStringsTests.cs b/src/RoslynAnalyzers/Roslyn.Diagnostics.Analyzers/UnitTests/CSharpDoNotUseDebugAssertForInterpolatedStringsTests.cs
index cfb246b02b28b..cf29fba130b43 100644
--- a/src/RoslynAnalyzers/Roslyn.Diagnostics.Analyzers/UnitTests/CSharpDoNotUseDebugAssertForInterpolatedStringsTests.cs
+++ b/src/RoslynAnalyzers/Roslyn.Diagnostics.Analyzers/UnitTests/CSharpDoNotUseDebugAssertForInterpolatedStringsTests.cs
@@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.
using System.Threading.Tasks;
+using Microsoft.CodeAnalysis.Testing;
using Test.Utilities;
using Xunit;
using VerifyCS = Test.Utilities.CSharpCodeFixVerifier<
@@ -40,7 +41,7 @@ public static void Assert(bool condition, string message) { }
public Task InterpolatedString(string @string)
=> new VerifyCS.Test
{
- ReferenceAssemblies = AdditionalMetadataReferences.DefaultNetFramework,
+ ReferenceAssemblies = ReferenceAssemblies.NetFramework.Net472.Default,
TestCode = $$"""
using System.Diagnostics;
@@ -75,7 +76,7 @@ void M()
public Task NoCrashOnUsingStaticedAssert()
=> new VerifyCS.Test
{
- ReferenceAssemblies = AdditionalMetadataReferences.DefaultNetFramework,
+ ReferenceAssemblies = ReferenceAssemblies.NetFramework.Net472.Default,
TestCode = $$"""
using static System.Diagnostics.Debug;
@@ -92,6 +93,27 @@ void M()
LanguageVersion = Microsoft.CodeAnalysis.CSharp.LanguageVersion.CSharp12,
}.RunAsync();
+ [Fact]
+ public Task NoAssertForInterpolatedStringHandler()
+ => new VerifyCS.Test
+ {
+ ReferenceAssemblies = ReferenceAssemblies.Net.Net100,
+ TestCode = $$"""
+ using System.Diagnostics;
+
+ class C
+ {
+ void M()
+ {
+ Debug.Assert(false, $"{0}");
+ }
+ }
+
+ {{RoslynDebug}}
+ """,
+ LanguageVersion = Microsoft.CodeAnalysis.CSharp.LanguageVersion.CSharp12,
+ }.RunAsync();
+
[Theory]
[InlineData("""
$"{"0"}"
diff --git a/src/RoslynAnalyzers/Test.Utilities/Test.Utilities.csproj b/src/RoslynAnalyzers/Test.Utilities/Test.Utilities.csproj
index 93c0156842dda..255200081d2d8 100644
--- a/src/RoslynAnalyzers/Test.Utilities/Test.Utilities.csproj
+++ b/src/RoslynAnalyzers/Test.Utilities/Test.Utilities.csproj
@@ -18,17 +18,18 @@
-
-
-
-
-
+
+
+
+
+
+
diff --git a/src/RoslynSdk/Directory.Packages.props b/src/RoslynSdk/Directory.Packages.props
index 341ff519960fc..112ebf77cf531 100644
--- a/src/RoslynSdk/Directory.Packages.props
+++ b/src/RoslynSdk/Directory.Packages.props
@@ -3,7 +3,7 @@
- 7.0.3
+ 6.14.3
6.3.4
diff --git a/src/RoslynSdk/Microsoft.CodeAnalysis.Testing/Directory.Build.targets b/src/RoslynSdk/Microsoft.CodeAnalysis.Testing/Directory.Build.targets
index df598bc6d0d8a..8621deac6b67e 100644
--- a/src/RoslynSdk/Microsoft.CodeAnalysis.Testing/Directory.Build.targets
+++ b/src/RoslynSdk/Microsoft.CodeAnalysis.Testing/Directory.Build.targets
@@ -1,4 +1,8 @@
-
\ No newline at end of file
+
+
+ false
+
+
diff --git a/src/RoslynSdk/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.Analyzer.Testing/ReferenceAssemblies.cs b/src/RoslynSdk/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.Analyzer.Testing/ReferenceAssemblies.cs
index 5c16abaa30025..a638db0617018 100644
--- a/src/RoslynSdk/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.Analyzer.Testing/ReferenceAssemblies.cs
+++ b/src/RoslynSdk/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.Analyzer.Testing/ReferenceAssemblies.cs
@@ -97,7 +97,7 @@ public static ReferenceAssemblies Default
#elif NETCOREAPP3_1
return NetCore.NetCoreApp31;
#elif NET10_0_OR_GREATER
- return Net.Net100;
+ return NetCore.NetCoreApp31;
#endif
}
}
diff --git a/src/RoslynSdk/Microsoft.CodeAnalysis.Testing/Test/Microsoft.CodeAnalysis.Analyzer.Testing.UnitTests/MetadataReferenceTests.cs b/src/RoslynSdk/Microsoft.CodeAnalysis.Testing/Test/Microsoft.CodeAnalysis.Analyzer.Testing.UnitTests/MetadataReferenceTests.cs
index 8dcf5aa6c44d6..0657e000a5784 100644
--- a/src/RoslynSdk/Microsoft.CodeAnalysis.Testing/Test/Microsoft.CodeAnalysis.Analyzer.Testing.UnitTests/MetadataReferenceTests.cs
+++ b/src/RoslynSdk/Microsoft.CodeAnalysis.Testing/Test/Microsoft.CodeAnalysis.Analyzer.Testing.UnitTests/MetadataReferenceTests.cs
@@ -14,6 +14,12 @@ namespace Microsoft.CodeAnalysis.Testing
{
public class MetadataReferenceTests
{
+#if NET
+ [Fact]
+ public void DefaultReferenceAssembliesUseNetCoreApp31()
+ => Assert.Same(ReferenceAssemblies.NetCore.NetCoreApp31, ReferenceAssemblies.Default);
+#endif
+
[Fact]
public async Task ResolveReferenceAssemblies_Net20()
{
diff --git a/src/RoslynSdk/Samples/Directory.Packages.props b/src/RoslynSdk/Samples/Directory.Packages.props
index b93b46f597493..d50ed46068a24 100644
--- a/src/RoslynSdk/Samples/Directory.Packages.props
+++ b/src/RoslynSdk/Samples/Directory.Packages.props
@@ -5,6 +5,10 @@
+
+
+
+
diff --git a/src/VisualStudio/IntegrationTest/Harness/SourceGeneratorUnitTests/Microsoft.VisualStudio.Extensibility.Testing.SourceGenerator.UnitTests.csproj b/src/VisualStudio/IntegrationTest/Harness/SourceGeneratorUnitTests/Microsoft.VisualStudio.Extensibility.Testing.SourceGenerator.UnitTests.csproj
index 45ee676290221..84deb3a59eb55 100644
--- a/src/VisualStudio/IntegrationTest/Harness/SourceGeneratorUnitTests/Microsoft.VisualStudio.Extensibility.Testing.SourceGenerator.UnitTests.csproj
+++ b/src/VisualStudio/IntegrationTest/Harness/SourceGeneratorUnitTests/Microsoft.VisualStudio.Extensibility.Testing.SourceGenerator.UnitTests.csproj
@@ -8,7 +8,6 @@
-
@@ -25,6 +24,7 @@
+
diff --git a/src/Workspaces/CoreTestUtilities/Microsoft.CodeAnalysis.Workspaces.Test.Utilities.csproj b/src/Workspaces/CoreTestUtilities/Microsoft.CodeAnalysis.Workspaces.Test.Utilities.csproj
index 515460944cc30..fe04b65c7fb18 100644
--- a/src/Workspaces/CoreTestUtilities/Microsoft.CodeAnalysis.Workspaces.Test.Utilities.csproj
+++ b/src/Workspaces/CoreTestUtilities/Microsoft.CodeAnalysis.Workspaces.Test.Utilities.csproj
@@ -26,16 +26,18 @@
-
-
-
-
-
-
+
+
+
+
+
+
+
+