diff --git a/Directory.Build.props b/Directory.Build.props
index e40a2279585b..64fcb52110f6 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -79,10 +79,20 @@
false
+
+
+ false
+
+
enable
+
+
+ false
+
+
diff --git a/eng/Versions.props b/eng/Versions.props
index eeff75233b8c..2b40b0c484ac 100644
--- a/eng/Versions.props
+++ b/eng/Versions.props
@@ -142,6 +142,12 @@
10.0.100
+
+
10.0.0
36.1.2
26.0.11017
diff --git a/src/Layout/redist/targets/BundledManifests.targets b/src/Layout/redist/targets/BundledManifests.targets
index c945bc73b872..99fb9dddc898 100644
--- a/src/Layout/redist/targets/BundledManifests.targets
+++ b/src/Layout/redist/targets/BundledManifests.targets
@@ -1,12 +1,12 @@
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/src/Microsoft.CodeAnalysis.NetAnalyzers/src/Microsoft.CodeAnalysis.NetAnalyzers/AnalyzerReleases.Shipped.md b/src/Microsoft.CodeAnalysis.NetAnalyzers/src/Microsoft.CodeAnalysis.NetAnalyzers/AnalyzerReleases.Shipped.md
index 4e76ada6af3e..d13ae5e93b8e 100644
--- a/src/Microsoft.CodeAnalysis.NetAnalyzers/src/Microsoft.CodeAnalysis.NetAnalyzers/AnalyzerReleases.Shipped.md
+++ b/src/Microsoft.CodeAnalysis.NetAnalyzers/src/Microsoft.CodeAnalysis.NetAnalyzers/AnalyzerReleases.Shipped.md
@@ -362,3 +362,16 @@ CA2262 | Usage | Info | ProvideHttpClientHandlerMaxResponseHeaderLengthValueCorr
CA2263 | Usage | Info | PreferGenericOverloadsAnalyzer, [Documentation](https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2263)
CA2264 | Usage | Warning | DoNotPassNonNullableValueToArgumentNullExceptionThrowIfNull, [Documentation](https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2264)
CA2265 | Usage | Warning | DoNotCompareSpanToNullAnalyzer, [Documentation](https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2265)
+
+## Release 10.0
+
+### New Rules
+
+Rule ID | Category | Severity | Notes
+--------|----------|----------|-------
+CA1873 | Performance | Info | AvoidPotentiallyExpensiveCallWhenLoggingAnalyzer, [Documentation](https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1873)
+CA1874 | Performance | Info | UseRegexMembers, [Documentation](https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1874)
+CA1875 | Performance | Info | UseRegexMembers, [Documentation](https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1875)
+CA2023 | Reliability | Warning | LoggerMessageDefineAnalyzer, [Documentation](https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2023)
+CA2024 | Reliability | Warning | DoNotUseEndOfStreamInAsyncMethods, [Documentation](https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2024)
+CA2025 | Reliability | Disabled | DoNotPassDisposablesIntoUnawaitedTasksAnalyzer, [Documentation](https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2025)
diff --git a/src/Microsoft.CodeAnalysis.NetAnalyzers/src/Microsoft.CodeAnalysis.NetAnalyzers/AnalyzerReleases.Unshipped.md b/src/Microsoft.CodeAnalysis.NetAnalyzers/src/Microsoft.CodeAnalysis.NetAnalyzers/AnalyzerReleases.Unshipped.md
index 0ecf6597797e..cdf4f1397e0b 100644
--- a/src/Microsoft.CodeAnalysis.NetAnalyzers/src/Microsoft.CodeAnalysis.NetAnalyzers/AnalyzerReleases.Unshipped.md
+++ b/src/Microsoft.CodeAnalysis.NetAnalyzers/src/Microsoft.CodeAnalysis.NetAnalyzers/AnalyzerReleases.Unshipped.md
@@ -1,12 +1 @@
; Please do not edit this file manually, it should only be updated through code fix application.
-
-### New Rules
-
-Rule ID | Category | Severity | Notes
---------|----------|----------|-------
-CA1873 | Performance | Info | AvoidPotentiallyExpensiveCallWhenLoggingAnalyzer, [Documentation](https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1873)
-CA1874 | Performance | Info | UseRegexMembers, [Documentation](https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1874)
-CA1875 | Performance | Info | UseRegexMembers, [Documentation](https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1875)
-CA2023 | Reliability | Warning | LoggerMessageDefineAnalyzer, [Documentation](https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2023)
-CA2024 | Reliability | Warning | DoNotUseEndOfStreamInAsyncMethods, [Documentation](https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2024)
-CA2025 | Reliability | Disabled | DoNotPassDisposablesIntoUnawaitedTasksAnalyzer, [Documentation](https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2025)
diff --git a/src/SourceBuild/patches/runtime/0001-release-9.0-staging-Add-flags-when-the-clang-s-major.patch b/src/SourceBuild/patches/runtime/0001-release-9.0-staging-Add-flags-when-the-clang-s-major.patch
new file mode 100644
index 000000000000..395dea35c1ae
--- /dev/null
+++ b/src/SourceBuild/patches/runtime/0001-release-9.0-staging-Add-flags-when-the-clang-s-major.patch
@@ -0,0 +1,145 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Aaron R Robinson
+Date: Fri, 14 Nov 2025 11:01:28 -0800
+Subject: [PATCH] [release/9.0-staging] Add flags when the clang's major
+ version is > 20.0 (#121151)
+Backport: https://github.com/dotnet/runtime/pull/121151
+
+## Customer Impact
+
+- [x] Customer reported
+- [ ] Found internally
+
+These issues were reported in
+https://github.com/dotnet/runtime/issues/119706 as problems with
+clang-21 on Fedora 43. The investigation uncovered that clang introduced
+a potentially breaking change in clang-20 that we do not currently
+consume. These build changes impact VMR related builds when linux
+distrobutions performing source build adopt clang-21.
+
+clang-20 breaking change log -
+https://releases.llvm.org/20.1.0/tools/clang/docs/ReleaseNotes.html#potentially-breaking-changes.
+
+This PR contains the minimal changes needed to fix issues from the
+following PR https://github.com/dotnet/runtime/pull/120775.
+
+.NET 10: https://github.com/dotnet/runtime/pull/121124
+.NET 8: https://github.com/dotnet/runtime/pull/121150
+
+## Regression
+
+- [ ] Yes
+- [x] No
+
+Build with the new clang-21 compiler will cause the runtime to crash.
+
+## Testing
+
+This has been validated using various legs and examples to demonstrate
+the usage of undefined behavior these flags convert into "defined"
+behavior in C/C++.
+
+## Risk
+
+Low. This has zero impact on our production build since we specifically
+target clang-18. This is only valid for those partners that are using
+clang-20+.
+---
+ eng/native/configurecompiler.cmake | 18 +++++++++++++++---
+ src/coreclr/debug/di/rspriv.h | 4 ++--
+ src/coreclr/debug/di/rsthread.cpp | 12 ++++++------
+ 3 files changed, 23 insertions(+), 11 deletions(-)
+
+diff --git a/eng/native/configurecompiler.cmake b/eng/native/configurecompiler.cmake
+index 109b947e4eb..c114c03a9a1 100644
+--- a/eng/native/configurecompiler.cmake
++++ b/eng/native/configurecompiler.cmake
+@@ -526,9 +526,21 @@ if (CLR_CMAKE_HOST_UNIX)
+ # Disable frame pointer optimizations so profilers can get better call stacks
+ add_compile_options(-fno-omit-frame-pointer)
+
+- # Make signed arithmetic overflow of addition, subtraction, and multiplication wrap around
+- # using twos-complement representation (this is normally undefined according to the C++ spec).
+- add_compile_options(-fwrapv)
++ if((CMAKE_C_COMPILER_ID STREQUAL "Clang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 20.0) OR
++ (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 20.0))
++ # Make signed overflow well-defined. Implies the following flags in clang-20 and above.
++ # -fwrapv - Make signed arithmetic overflow of addition, subtraction, and multiplication wrap around
++ # using twos-complement representation (this is normally undefined according to the C++ spec).
++ # -fwrapv-pointer - The same as -fwrapv but for pointers.
++ add_compile_options(-fno-strict-overflow)
++
++ # Suppress C++ strict aliasing rules. This matches our use of MSVC.
++ add_compile_options(-fno-strict-aliasing)
++ else()
++ # Make signed arithmetic overflow of addition, subtraction, and multiplication wrap around
++ # using twos-complement representation (this is normally undefined according to the C++ spec).
++ add_compile_options(-fwrapv)
++ endif()
+
+ if(CLR_CMAKE_HOST_APPLE)
+ # Clang will by default emit objc_msgSend stubs in Xcode 14, which ld from earlier Xcodes doesn't understand.
+diff --git a/src/coreclr/debug/di/rspriv.h b/src/coreclr/debug/di/rspriv.h
+index 7e2b49b3170..119ca6f7c08 100644
+--- a/src/coreclr/debug/di/rspriv.h
++++ b/src/coreclr/debug/di/rspriv.h
+@@ -6404,8 +6404,8 @@ private:
+ // Lazily initialized.
+ EXCEPTION_RECORD * m_pExceptionRecord;
+
+- static const CorDebugUserState kInvalidUserState = CorDebugUserState(-1);
+- CorDebugUserState m_userState; // This is the current state of the
++ static const int kInvalidUserState = -1;
++ int m_userState; // This is the current state of the
+ // thread, at the time that the
+ // left side synchronized
+
+diff --git a/src/coreclr/debug/di/rsthread.cpp b/src/coreclr/debug/di/rsthread.cpp
+index cd7f79867a5..8c4f3317eff 100644
+--- a/src/coreclr/debug/di/rsthread.cpp
++++ b/src/coreclr/debug/di/rsthread.cpp
+@@ -783,7 +783,7 @@ CorDebugUserState CordbThread::GetUserState()
+ m_userState = pDAC->GetUserState(m_vmThreadToken);
+ }
+
+- return m_userState;
++ return (CorDebugUserState)m_userState;
+ }
+
+
+@@ -887,7 +887,7 @@ HRESULT CordbThread::CreateStepper(ICorDebugStepper ** ppStepper)
+ //Returns true if current user state of a thread is USER_WAIT_SLEEP_JOIN
+ bool CordbThread::IsThreadWaitingOrSleeping()
+ {
+- CorDebugUserState userState = m_userState;
++ int userState = m_userState;
+ if (userState == kInvalidUserState)
+ {
+ //If m_userState is not ready, we'll read from DAC only part of it which
+@@ -3721,14 +3721,14 @@ HRESULT CordbUnmanagedThread::SetupFirstChanceHijackForSync()
+ LOG((LF_CORDB, LL_INFO10000, "CUT::SFCHFS: hijackCtx started as:\n"));
+ LogContext(GetHijackCtx());
+
+- // Save the thread's full context for all platforms except for x86 because we need the
++ // Save the thread's full context for all platforms except for x86 because we need the
+ // DT_CONTEXT_EXTENDED_REGISTERS to avoid getting incomplete information and corrupt the thread context
+ DT_CONTEXT context;
+-#ifdef TARGET_X86
++#ifdef TARGET_X86
+ context.ContextFlags = DT_CONTEXT_FULL | DT_CONTEXT_EXTENDED_REGISTERS;
+ #else
+ context.ContextFlags = DT_CONTEXT_FULL;
+-#endif
++#endif
+
+ BOOL succ = DbiGetThreadContext(m_handle, &context);
+ _ASSERTE(succ);
+@@ -3739,7 +3739,7 @@ HRESULT CordbUnmanagedThread::SetupFirstChanceHijackForSync()
+ LOG((LF_CORDB, LL_ERROR, "CUT::SFCHFS: DbiGetThreadContext error=0x%x\n", error));
+ }
+
+-#ifdef TARGET_X86
++#ifdef TARGET_X86
+ GetHijackCtx()->ContextFlags = DT_CONTEXT_FULL | DT_CONTEXT_EXTENDED_REGISTERS;
+ #else
+ GetHijackCtx()->ContextFlags = DT_CONTEXT_FULL;
diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.Analyzers.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.Analyzers.targets
index bfe44a366470..0c206deb1e52 100644
--- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.Analyzers.targets
+++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.Analyzers.targets
@@ -22,8 +22,8 @@ Copyright (c) .NET Foundation. All rights reserved.
<_NoneAnalysisLevel>4.0
- <_LatestAnalysisLevel>9.0
- <_PreviewAnalysisLevel>10.0
+ <_LatestAnalysisLevel>10.0
+ <_PreviewAnalysisLevel>11.0
Path.GetFileName(file).Equals(expectedGlobalConfig, StringComparison.OrdinalIgnoreCase));
+ matchingConfigs.Should().ContainSingle(
+ $"""
+ Expected to find globalconfig '{expectedGlobalConfig}' for AnalysisLevel=latest.
+
+ To fix this test failure:
+ (1) Update the AnalyzerReleases files:
+ - Edit 'src/Microsoft.CodeAnalysis.NetAnalyzers/src/Microsoft.CodeAnalysis.NetAnalyzers/AnalyzerReleases.Shipped.md'
+ to create a new release section for the prior analysis level version (e.g., '## Release 10.0').
+ - Move all entries from 'AnalyzerReleases.Unshipped.md' to the new release section.
+ - Repeat for C#/VB.NET specific files if they have unshipped entries.
+ (2) Update _LatestAnalysisLevel and _PreviewAnalysisLevel in
+ 'src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.Analyzers.targets'.
+ (3) Rebuild the SDK to regenerate the globalconfig files.
+ """);
+
+ var globalConfigPath = matchingConfigs.Single();
+ File.Exists(globalConfigPath).Should().BeTrue(
+ $"The globalconfig file '{expectedGlobalConfig}' should exist on disk.");
+ }
+
[InlineData("preview")]
[InlineData("latest")]
[InlineData("none")]
@@ -277,23 +357,22 @@ static void Main()
[InlineData("9.0", "", "true", "")]
[InlineData("9", "default", "false", "Security")]
[InlineData("9.0", "", "true", "Usage")]
+ [InlineData("10", "default", "false", "")]
+ [InlineData("10.0", "", "true", "")]
+ [InlineData("10", "default", "false", "Security")]
+ [InlineData("10.0", "", "true", "Usage")]
[RequiresMSBuildVersionTheory("16.8")]
public void It_maps_analysis_properties_to_globalconfig(string analysisLevel, string analysisMode, string codeAnalysisTreatWarningsAsErrors, string category)
{
// Documentation: https://learn.microsoft.com/dotnet/core/project-sdk/msbuild-props#code-analysis-properties
-
+ //
// NOTE: This test will fail for "latest" analysisLevel when the "_LatestAnalysisLevel" property
- // is bumped in Microsoft.NET.Sdk.Analyzers.targets without a corresponding change in dotnet/roslyn-analyzers
- // repo that generates and maps to the globalconfig. This is an important regression test to ensure the
+ // is bumped in Microsoft.NET.Sdk.Analyzers.targets without a corresponding change in the the analyzers
+ // source in this repo that generates and maps to the globalconfig. This is an important regression test to ensure the
// "latest" analysisLevel setting keeps working as expected when moving to a newer version of the .NET SDK.
- // Following changes are needed to ensure the failing test scenario passes again:
- // 1. In dotnet/roslyn-analyzers repo:
- // a. Update "src/NetAnalyzers/Core/AnalyzerReleases.Shipped.md"to create a new release
- // for the prior "_LatestAnalysisLevel" value and move all the entries from
- // "src/NetAnalyzers/Core/AnalyzerReleases.Unshipped.md" to the shipped file.
- // For example, see https://github.com/dotnet/roslyn-analyzers/pull/6246.
- // 2. In dotnet/sdk repo:
- // a. Consume the new Microsoft.CodeAnalysis.NetAnalyzers package with the above sha.
+ //
+ // See the It_has_globalconfig_for_latest_analysis_level test for more explicit validation and detailed
+ // instructions on what changes are needed when bumping to a new TFM.
var testProject = new TestProject
{
diff --git a/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsTests.cs b/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsTests.cs
index 033d929a9e1f..307e257ed6c1 100644
--- a/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsTests.cs
+++ b/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsTests.cs
@@ -278,14 +278,14 @@ public void RunMultipleTestProjectsWithDifferentFailures_ShouldReturnExitCodeGen
CommandResult result = new DotnetTestCommand(Log, disableNewOutput: false)
.WithWorkingDirectory(testInstance.Path)
- .Execute("--minimum-expected-tests 2",
+ .Execute("--minimum-expected-tests", "2",
"-c", configuration);
if (!TestContext.IsLocalized())
{
Assert.Matches(RegexPatternHelper.GenerateProjectRegexPattern("TestProject", TestingConstants.ZeroTestsRan, true, configuration, "8"), result.StdOut);
Assert.Matches(RegexPatternHelper.GenerateProjectRegexPattern("OtherTestProject", TestingConstants.Failed, true, configuration, "2"), result.StdOut);
- Assert.Matches(RegexPatternHelper.GenerateProjectRegexPattern("AnotherTestProject", TestingConstants.Failed, true, configuration, "9"), result.StdOut);
+ Assert.Matches(RegexPatternHelper.GenerateProjectRegexPattern("AnotherTestProject", TestingConstants.Passed, true, configuration), result.StdOut);
result.StdOut
.Should().Contain("Test run summary: Failed!")
diff --git a/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsTestsWithArtifacts.cs b/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsTestsWithArtifacts.cs
index f8c76d625d8c..6736b5809c51 100644
--- a/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsTestsWithArtifacts.cs
+++ b/test/dotnet.Tests/CommandTests/Test/GivenDotnetTestBuildsAndRunsTestsWithArtifacts.cs
@@ -47,7 +47,8 @@ public void RunTestProjectWithFailingTestsAndFileArtifacts_ShouldReturnExitCodeG
[InlineData(TestingConstants.Debug)]
[InlineData(TestingConstants.Release)]
- [Theory]
+ // Linux and macOS are being skipped. See: https://github.com/dotnet/sdk/issues/52029
+ [WindowsOnlyTheory]
public void RunTestProjectWithCodeCoverage_ShouldReturnExitCodeGenericFailure(string configuration)
{
TestAsset testInstance = _testAssetsManager.CopyTestAsset("TestProjectSolutionWithCodeCoverage", Guid.NewGuid().ToString()).WithSource();