Skip to content

Conversation

@joperezr
Copy link
Member

@joperezr joperezr commented Oct 31, 2025

This will make it such that all projects will also target Net10, as well as have a different dependency group so that they flow net10 dependency versions in order to not break out of the shared framework.

cc: @stephentoub @ericstj @jeffhandley

Microsoft Reviewers: Open in CodeFlow

Copilot AI review requested due to automatic review settings October 31, 2025 21:53
@joperezr joperezr requested review from a team as code owners October 31, 2025 21:53
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for .NET 10.0 target framework to the repository. The major version is updated from 9 to 10, and the existing infrastructure is extended to handle net10.0 alongside net9.0 and net8.0.

  • Updates the major target framework from net9.0 to net10.0, while maintaining support for net9.0 and net8.0
  • Adds package version definitions for .NET 10.0 RC2 dependencies from runtime and ASP.NET Core repos
  • Fixes conditional compilation directives to use NET9_0_OR_GREATER for broader version coverage
  • Updates test code to use the modern IHost/HostBuilder pattern instead of the obsolete IWebHost/WebHost APIs

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
Directory.Build.props Updates major framework version to 10 and adds net9.0 to the multi-targeting list
eng/Versions.props Adds version properties for all .NET 10.0 RC2 package dependencies
eng/packages/General.props Imports the new General-net10.props file
eng/packages/General-net9.props Fixes condition to exclude when ForceLatestDotnetVersions is true
eng/packages/General-net10.props Defines package versions for net10.0 target framework
eng/packages/General-LTS.props Updates condition to exclude net10.0 from LTS package versions
eng/packages/TestOnly.props Splits test package references to handle both net9.0 and net10.0 specifically
src/Shared/Shared.csproj Conditionally excludes ServerSentEvents for net10.0 builds
src/Libraries/Microsoft.Extensions.AI.OpenAI/Microsoft.Extensions.AI.OpenAI.csproj Conditionally disables shared ServerSentEvents injection for net10.0
test/Shared/JsonSchemaExporter/JsonSchemaExporterTests.cs Changes conditional compilation from NET9_0 to NET9_0_OR_GREATER
test/Libraries/Microsoft.Extensions.Http.Resilience.Tests/Resilience/GrpcResilienceTests.cs Migrates from obsolete WebHost to modern HostBuilder pattern
test/Libraries/Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests/Linux/AcceptanceTest.cs Conditionally excludes System.Linq for NET10_0 to avoid conflicts with built-in extension methods

@joperezr
Copy link
Member Author

@stephentoub there is a failure in MEAI.Abstraction tests. Could you take a look while I investigate the rest?

  Failed Microsoft.Extensions.AI.AIJsonUtilitiesTests.AddAIContentType_ConflictingIdentifier_ThrowsInvalidOperationException [4 ms]
  Error Message:
   Assert.Throws() Failure: Exception type was not an exact match
Expected: typeof(System.InvalidOperationException)
Actual:   typeof(System.NotSupportedException)
---- System.NotSupportedException : JsonTypeInfo metadata for type 'Microsoft.Extensions.AI.AIJsonUtilitiesTests+DerivedAIContent' was not provided by TypeInfoResolver of type 'System.Text.Json.Serialization.Metadata.JsonTypeInfoResolverWithAddedModifiers'. If using source generation, ensure that all root types passed to the serializer have been annotated with 'JsonSerializableAttribute', along with any types that might be serialized polymorphically.
  Stack Trace:
     at Microsoft.Extensions.AI.AIJsonUtilitiesTests.AddAIContentType_ConflictingIdentifier_ThrowsInvalidOperationException() in D:\a\_work\1\s\test\Libraries\Microsoft.Extensions.AI.Abstractions.Tests\Utilities\AIJsonUtilitiesTests.cs:line 1089
   at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
----- Inner Stack Trace -----
   at System.Text.Json.ThrowHelper.ThrowNotSupportedException_NoMetadataForType(Type type, IJsonTypeInfoResolver resolver)
   at System.Text.Json.JsonSerializerOptions.GetTypeInfoInternal(Type type, Boolean ensureConfigured, Nullable`1 ensureNotNull, Boolean resolveIfMutable, Boolean fallBackToNearestAncestorType)
   at System.Text.Json.Serialization.Metadata.PolymorphicTypeResolver..ctor(JsonSerializerOptions options, JsonPolymorphismOptions polymorphismOptions, Type baseType, Boolean converterCanHaveMetadata)
   at System.Text.Json.Serialization.Metadata.JsonTypeInfo.Configure()
   at System.Text.Json.Serialization.Metadata.JsonTypeInfo.<EnsureConfigured>g__ConfigureSynchronized|174_0()
   at System.Text.Json.JsonSerializerOptions.GetTypeInfoInternal(Type type, Boolean ensureConfigured, Nullable`1 ensureNotNull, Boolean resolveIfMutable, Boolean fallBackToNearestAncestorType)
   at System.Text.Json.JsonSerializerOptions.GetTypeInfoForRootType(Type type, Boolean fallBackToNearestAncestorType)
   at System.Text.Json.JsonSerializer.GetTypeInfo[T](JsonSerializerOptions options)
   at System.Text.Json.JsonSerializer.Serialize[TValue](TValue value, JsonSerializerOptions options)
   at Microsoft.Extensions.AI.AIJsonUtilitiesTests.<>c__DisplayClass30_0.<AddAIContentType_ConflictingIdentifier_ThrowsInvalidOperationException>b__0() in D:\a\_work\1\s\test\Libraries\Microsoft.Extensions.AI.Abstractions.Tests\Utilities\AIJsonUtilitiesTests.cs:line 1089

@jeffhandley
Copy link
Member

@stephentoub there is a failure in MEAI.Abstraction tests. Could you take a look while I investigate the rest?

I'm taking a look...

@jeffhandley
Copy link
Member

@stephentoub / @eiriktsarpalis - The AIJsonUtilitiesTests.AddAIContentType_ConflictingIdentifier_ThrowsInvalidOperationException test is behaving differently between net9.0 and net10.0. I'm still investigating, but in net10.0 it is resulting in a NotSupportedException indicatin the type has not been registered for resolution rather than the InvalidOperationException because of having been registered twice as occurs in net9.0.

I'll continue investigating Saturday.

@joperezr joperezr requested a review from a team as a code owner November 3, 2025 19:39
…rovider

Replace single clock.Advance/Wait uses with a polling loop that repeatedly
advances the FakeTimeProvider and briefly waits to ensure ExecuteAsync's
_delay_ is armed and completes across different runtimes. Add a maxAttempts
guard and assertions to avoid indefinite hangs and to validate that a log
record or publisher invocation actually occurred before proceeding.
…10 and skip on Windows

Add NET10_0_OR_GREATER preprocessor block and apply ConditionalFact plus OSSkipCondition to avoid flaky behavior on Windows for .NET 10.
…eMonitoringServiceTests

Replace NET10_0_OR_GREATER with NET10_0 so the ConditionalFact/OS skip targets .NET 10 only,
and add the missing Microsoft.TestUtilities using required for OSSkipCondition. This stabilizes
the RunTrackerAsync_IfProviderThrows_LogsError test behavior on .NET 10.
@ericstj
Copy link
Member

ericstj commented Nov 4, 2025

I fixed the JsonSerialization test.

@ericstj
Copy link
Member

ericstj commented Nov 4, 2025

@joperezr looks like we now have timeouts in the Microsoft.Extensions.Diagnostics.ResourceMonitoring.Test.ResourceMonitoringServiceTests.RunTrackerAsync_IfProviderThrows_LogsError test. Who can look at that?

@joperezr
Copy link
Member Author

joperezr commented Nov 4, 2025

@joperezr looks like we now have timeouts in the Microsoft.Extensions.Diagnostics.ResourceMonitoring.Test.ResourceMonitoringServiceTests.RunTrackerAsync_IfProviderThrows_LogsError test. Who can look at that?

I was trying to get this test to work but seems like a flaky test, failing different places. I'll just skip it for now and will assign it to someone on the ResourceMonitoring side so we can get this PR unblocked.

@joperezr joperezr enabled auto-merge (squash) November 4, 2025 19:40
@joperezr joperezr merged commit 8df3159 into dotnet:main Nov 4, 2025
6 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Dec 6, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants