Update to .NET 10 - #933
Merged
Merged
Conversation
Upgrade the .NET SDK from version 9.0.301 to 10.0.400 with latestFeature rollforward policy.
Update C# language version from preview to latest for build stability, and update copyright year to 2026.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
These packages are automatically available on .NET 10, so referencing them explicitly produces NU1510. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The generators and code fixers now require Roslyn 5.0 (ie. the .NET 10 SDK) as their minimum supported version. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Partial properties and the 'field' keyword are no longer preview features, and .NET 10 projects default to C# 14, so gating [GeneratedCanvasEffectProperty] on 'LangVersion=preview' just disabled the generator. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This version no longer requires the C# 'preview' language version to use [ObservableProperty] on partial properties. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The .NET 10 SDK always uses the .NET hosted compiler for SDK-style projects, so compiler extensions no longer have to target .NET Standard 2.0. This also removes the HashCode polyfill, which the BCL now provides, and fixes the nullability warnings that the annotated .NET reference assemblies surface. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This switches the test reference assemblies to .NET 10 and the default language version to C# 14, so the tests match the framework and language version the generators actually target. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The packages now target .NET 10, which can only be built with the .NET 10 SDK, so the compiler is always recent enough for the generators to load. This makes the check dead logic, which leaves several .targets files completely empty. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The ILLink substitution XML is no longer supported, and [FeatureSwitchDefinition] is the modern replacement for it. This also lets the switches be defined entirely in code, so the property names no longer have to be kept in sync with a separate file. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Using a [FixedAddressValueType] field instead of RuntimeHelpers.AllocateTypeAssociatedMemory removes the runtime allocation and initialization work, and it also avoids rooting the reflection metadata for all these types in AOT builds. Each vtable now also gets its own type in a dedicated file, instead of merging multiple vtables into a single allocation. This fixes a latent bug in D2D1DrawInfoUpdateContextImpl, where the ID2D1DrawInfoUpdateContextInternal vtable pointer was off by one slot. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This removes the last use of RuntimeHelpers.AllocateTypeAssociatedMemory, and it also lets the source generator share the exact same code as the runtime library. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
All projects target .NET 10 now, including the source generators and code fixers, so none of the polyfills are needed anymore. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The .NET 10 SDK requires MSBuild 18.0 or greater, which is only available on images shipping Visual Studio 2026. The windows-2022 image is still on MSBuild 17.x, so it can no longer build .NET 10 projects. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The windows-2025 runner image no longer ships the Windows SDK 10.0.22621.0, which made packaging the UWP and WinUI projects fail with APPX3217. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The reference is now added from a shared 'BeforeMicrosoftNETSdkTargets' file, so all projects are guaranteed to use the same version, and all the common CsWinRT options are set in one place. This also enables the highest AOT warning level, which surfaced a non trim-safe cast and a few types that were missing the 'partial' modifier. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The projection assemblies in 'Microsoft.Windows.SDK.NET.Ref' are built against a specific version of 'WinRT.Runtime'. The version the .NET SDK selects by default is built against CsWinRT 2.2.0, so referencing CsWinRT 2.3.1 made ILLink report spurious IL2081 warnings for all the 'ABI.Windows.Foundation' types when publishing with trimming. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
As of .NET 8, the runtime identifier no longer implies 'SelfContained', and that property is only set automatically when publishing through 'dotnet publish'. The samples published with 'msbuild -t:publish' would therefore fail with NETSDK1102, as they also enable size optimizations. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
These tests compare the WIC decoder with the ImageSharp one, which inherently disagree by a bit on some pixels. The tolerance was tuned so tightly that the current WIC decoder is just 0.1% over it, so it's now aligned with the equivalent Rgba32 tests using the same image. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Now that all source generators target .NET 10, the regex source generator can be used to emit the matching logic at compile time. This replaces the cached interpreted regex-es and the RegexOptions.Compiled instances, which had to build their matchers at runtime. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 8d03bf3b-9de2-465c-a87c-f795178863c4
Sergio0694
force-pushed
the
dev/net10.0
branch
from
September 4, 2026 09:42
296306b to
50d9964
Compare
Requiring .NET 10 is a breaking change for consumers, so the next release moves to a new major version. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 8d03bf3b-9de2-465c-a87c-f795178863c4
Both libraries only compile against the Win2D API surface, which is resolved from the reference assembly in the package. They never resolve the native 'Microsoft.Graphics.Canvas.dll', as that is up to the consuming application, which still gets the Win2D build logic transitively. That is also why they are packed as 'AnyCPU', which is what made Win2D warn when packing. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 8d03bf3b-9de2-465c-a87c-f795178863c4
Win2D 1.4.0 depends on the split Windows App SDK packages rather than the single one, so the two updates have to happen together. Mixing them is not possible, as both sets of packages import the same .targets and the MSIX tooling then fails to wire itself up. The libraries now only reference what they actually use. 'ComputeSharp.WinUI' takes the WinUI package instead of the whole SDK, and 'ComputeSharp.D2D1.WinUI' takes only Win2D. The two packaged apps use the framework dependent deployment model, so they also take the runtime package, which is what adds the framework package dependency to their MSIX manifest. The CLI sample is self contained and does not need it. The Community Toolkit references move to the 8.3 previews, which are the first builds to use the split packages. The 8.2 releases still pull in the single package. This also drops the 'Microsoft.Web.WebView2' workaround from both UI libraries. It was pinning an older version to keep 'WebView2Loader.dll' out of the generated .pri files, and the version that now comes in no longer has that problem. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 8d03bf3b-9de2-465c-a87c-f795178863c4
These were just wrapping a single expression over the vtable fields, and being private they were not adding anything over using the fields directly. With them gone, the fields no longer need the 'Shared' prefix that was only there to tell them apart. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 8d03bf3b-9de2-465c-a87c-f795178863c4
Also turn on 'CsWin32RunAsBuildTask', so the interop is generated by a build task rather than by the source generator. The property is centralized, as it is a no-op for projects that do not use CsWin32. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 8d03bf3b-9de2-465c-a87c-f795178863c4
Now that the source generators target .NET 10, the BCL can load the libraries directly, so the manual 'LoadLibraryW' declaration is no longer needed. The failure is still surfaced as a Win32Exception, which is what callers catch to report a diagnostic instead of crashing, and the message from the BCL also names the file and the OS loader error. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 8d03bf3b-9de2-465c-a87c-f795178863c4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Updates the whole repo to .NET 10, including all source generators and code fixers.
Main changes
All projects now target .NET 10. Source generators and code fixers move off .NET Standard 2.0 as well, since the .NET 10 SDK always uses the .NET hosted compiler for SDK-style projects. Roslyn references are bumped to 5.0.0, which is now the minimum supported version.
Because everything is on the same target framework, a fair amount of code can be shared and simplified:
HashCodepolyfill is replaced by the one from the BCLSOURCE_GENERATORbranches are no longer needed, so generators and runtime libraries now compile the exact same code.targetsfiles are removed, which leaves four of those files empty and deletedOther cleanup
[FeatureSwitchDefinition]instead of the ILLink substitution XML, which is no longer supported[FixedAddressValueType]instead ofRuntimeHelpers.AllocateTypeAssociatedMemory, which removes the allocation and setup work at runtime, and avoids rooting reflection metadata for those types in AOT builds. Each vtable now lives in its own file, one per interface, instead of packing several into a single allocation. This also fixes a latent bug inD2D1DrawInfoUpdateContextImpl, where the vtable pointer forID2D1DrawInfoUpdateContextInternalwas off by one slot, so callingClose()would dispatch toRelease()instead.BeforeMicrosoftNETSdkTargetsfile, so all projects use the same version and options. This enables the highest AOT warning level, which surfaced a cast that wasn't trim safe and a few types missing thepartialmodifier.Build fixes
windows-2025image, as the .NET 10 SDK needs MSBuild 18.0 or greaterSelfContainedsince .NET 8Notes
The tolerance for the two
Bgra32JPEG imaging tests was slightly increased. Those tests compare the WIC decoder against the ImageSharp one, and the two disagree by a bit on some pixels. The value was tuned so tightly that the current WIC decoder is about 0.1% over it. This is not related to the migration: the same delta reproduces onmainwith .NET 8. The new value matches the equivalentRgba32tests using the same image.