Skip to content

Move extensions abstractions - #5206

Merged
ericstj merged 35 commits into
dotnet:mainfrom
ericstj:move-extensions-abstractions
Apr 6, 2026
Merged

ericstj merged 35 commits into
dotnet:mainfrom
ericstj:move-extensions-abstractions

Conversation

@ericstj

@ericstj ericstj commented Mar 3, 2026

Copy link
Copy Markdown
Member

Smaller version of #4669
Issue: dotnet/runtime#67487

Includes #5187.

ericstj added 5 commits March 2, 2026 19:24
Move the following packages from AspNetCore.App to the base NETCore.App shared framework:
- Microsoft.Extensions.DependencyInjection.Abstractions
- Microsoft.Extensions.Logging.Abstractions
- Microsoft.Extensions.Options
- Microsoft.Extensions.Primitives
- Microsoft.Extensions.Configuration.Abstractions
- Microsoft.Extensions.Diagnostics.Abstractions
- Microsoft.Extensions.FileProviders.Abstractions
- Microsoft.Extensions.Caching.Abstractions
- Microsoft.Extensions.Hosting.Abstractions

This is a reduced subset of the full hosting closure move (329b9c12b1b).
Copilot AI review requested due to automatic review settings March 3, 2026 22:44
@ericstj
ericstj requested review from a team as code owners March 3, 2026 22:44
@ericstj
ericstj marked this pull request as draft March 3, 2026 22:44
@ericstj ericstj added the NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) label Mar 3, 2026
@dotnet-policy-service
dotnet-policy-service Bot requested review from a team March 3, 2026 22:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 moves a subset of Microsoft.Extensions assemblies (primarily abstractions plus Options/Primitives) and related build infrastructure from the ASP.NET Core shared framework surface area toward the base shared framework (Microsoft.NETCore.App), and adjusts downstream repo/project references to account for the new shared framework availability.

Changes:

  • Add selected Microsoft.Extensions assemblies (and some generators) to NetCoreAppLibrary / NetCoreAppLibraryGenerator, and remove them from the ASP.NET Core shared framework list.
  • Add NetCoreAppCurrent-conditional ProjectReferences in runtime Microsoft.Extensions projects to support building as part of the base shared framework.
  • Update ASP.NET Core and Roslyn projects to avoid redundant references when targeting newer TFMs, and adjust package override / shared-framework packaging infrastructure.

Reviewed changes

Copilot reviewed 109 out of 109 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/runtime/src/libraries/NetCoreAppLibrary.props Moves selected Microsoft.Extensions assemblies into NetCoreAppLibrary and updates generator lists.
src/runtime/src/libraries/Microsoft.Extensions.Primitives/src/Microsoft.Extensions.Primitives.csproj Adds NetCoreAppCurrent-only ProjectReferences for runtime build integration.
src/runtime/src/libraries/Microsoft.Extensions.Primitives/ref/Microsoft.Extensions.Primitives.csproj Adds NetCoreAppCurrent-only ProjectReferences for ref build integration.
src/runtime/src/libraries/Microsoft.Extensions.Options/src/Microsoft.Extensions.Options.csproj Adds NetCoreAppCurrent-only ProjectReferences for runtime build integration.
src/runtime/src/libraries/Microsoft.Extensions.Options/ref/Microsoft.Extensions.Options.csproj Adds NetCoreAppCurrent-only ProjectReferences for ref build integration.
src/runtime/src/libraries/Microsoft.Extensions.Logging.Abstractions/src/Microsoft.Extensions.Logging.Abstractions.csproj Adds NetCoreAppCurrent-only ProjectReferences for runtime build integration.
src/runtime/src/libraries/Microsoft.Extensions.Logging.Abstractions/ref/Microsoft.Extensions.Logging.Abstractions.csproj Updates ref-project references for NetCoreAppCurrent builds.
src/runtime/src/libraries/Microsoft.Extensions.Hosting.Abstractions/src/Microsoft.Extensions.Hosting.Abstractions.csproj Adds NetCoreAppCurrent-only ProjectReferences for runtime build integration.
src/runtime/src/libraries/Microsoft.Extensions.Hosting.Abstractions/ref/Microsoft.Extensions.Hosting.Abstractions.csproj Adds NetCoreAppCurrent-only ProjectReferences for ref build integration and closure.
src/runtime/src/libraries/Microsoft.Extensions.FileProviders.Abstractions/src/Microsoft.Extensions.FileProviders.Abstractions.csproj Adds NetCoreAppCurrent-only ProjectReferences for runtime build integration.
src/runtime/src/libraries/Microsoft.Extensions.FileProviders.Abstractions/ref/Microsoft.Extensions.FileProviders.Abstractions.csproj Adds NetCoreAppCurrent-only ProjectReferences for ref build integration.
src/runtime/src/libraries/Microsoft.Extensions.Diagnostics.Abstractions/src/Microsoft.Extensions.Diagnostics.Abstractions.csproj Adds NetCoreAppCurrent-only ProjectReferences for runtime build integration.
src/runtime/src/libraries/Microsoft.Extensions.Diagnostics.Abstractions/ref/Microsoft.Extensions.Diagnostics.Abstractions.csproj Adds NetCoreAppCurrent-only ProjectReferences for ref build integration.
src/runtime/src/libraries/Microsoft.Extensions.DependencyInjection.Abstractions/src/Microsoft.Extensions.DependencyInjection.Abstractions.csproj Adds NetCoreAppCurrent-only ProjectReferences for runtime build integration.
src/runtime/src/libraries/Microsoft.Extensions.DependencyInjection.Abstractions/ref/Microsoft.Extensions.DependencyInjection.Abstractions.csproj Adds NetCoreAppCurrent-only ProjectReferences for ref build integration.
src/runtime/src/libraries/Microsoft.Extensions.Configuration.Abstractions/src/Microsoft.Extensions.Configuration.Abstractions.csproj Adds NetCoreAppCurrent-only ProjectReferences for runtime build integration.
src/runtime/src/libraries/Microsoft.Extensions.Configuration.Abstractions/ref/Microsoft.Extensions.Configuration.Abstractions.csproj Adds NetCoreAppCurrent-only ProjectReferences for ref build integration.
src/runtime/src/libraries/Microsoft.Extensions.Caching.Abstractions/src/Microsoft.Extensions.Caching.Abstractions.csproj Adds NetCoreAppCurrent-only ProjectReferences for runtime build integration.
src/runtime/src/libraries/Microsoft.Extensions.Caching.Abstractions/ref/Microsoft.Extensions.Caching.Abstractions.csproj Adds NetCoreAppCurrent-only ProjectReferences for ref build integration.
src/runtime/src/installer/pkg/sfx/Microsoft.NETCore.App/PackageOverrides.txt Adds package overrides for newly-included Microsoft.Extensions assemblies.
src/roslyn/src/Tools/GenerateRulesMissingDocumentation/GenerateRulesMissingDocumentation.csproj Disables known-pack version updates for a build-time tool.
src/roslyn/src/RoslynAnalyzers/Tools/GenerateDocumentationAndConfigFilesForBrokenRuntime/GenerateDocumentationAndConfigFilesForBrokenRuntime.csproj Disables known-pack version updates for a build-time tool.
src/roslyn/src/RoslynAnalyzers/Tools/GenerateDocumentationAndConfigFiles/GenerateDocumentationAndConfigFiles.csproj Disables known-pack version updates for a build-time tool.
src/roslyn/src/RoslynAnalyzers/Tools/GenerateAnalyzerNuspec/GenerateAnalyzerNuspec.csproj Disables known-pack version updates for a build-time tool.
src/roslyn/src/CodeStyle/Tools/CodeStyleConfigFileGenerator.csproj Disables known-pack version updates for a build-time tool.
src/aspnetcore/src/WebEncoders/test/Microsoft.Extensions.WebEncoders.Tests.csproj Makes certain Microsoft.Extensions references conditional based on TFM compatibility.
src/aspnetcore/src/WebEncoders/src/Microsoft.Extensions.WebEncoders.csproj Makes certain Microsoft.Extensions references conditional based on TFM compatibility.
src/aspnetcore/src/Validation/test/Microsoft.Extensions.Validation.GeneratorTests/Microsoft.Extensions.Validation.GeneratorTests.csproj Removes a redundant Microsoft.Extensions reference.
src/aspnetcore/src/Validation/src/Microsoft.Extensions.Validation.csproj Removes redundant Microsoft.Extensions references.
src/aspnetcore/src/Tools/dotnet-user-jwts/src/dotnet-user-jwts.csproj Removes a redundant Microsoft.Extensions reference.
src/aspnetcore/src/Tools/GetDocumentInsider/src/GetDocument.Insider.csproj Makes Microsoft.Extensions.Hosting.Abstractions reference conditional.
src/aspnetcore/src/SignalR/server/StackExchangeRedis/src/Microsoft.AspNetCore.SignalR.StackExchangeRedis.csproj Removes a redundant Microsoft.Extensions reference.
src/aspnetcore/src/SignalR/server/Core/src/Microsoft.AspNetCore.SignalR.Core.csproj Removes redundant Microsoft.Extensions references.
src/aspnetcore/src/SignalR/common/SignalR.Common/src/Microsoft.AspNetCore.SignalR.Common.csproj Makes Microsoft.Extensions.Options reference conditional.
src/aspnetcore/src/SignalR/clients/csharp/Http.Connections.Client/src/Microsoft.AspNetCore.Http.Connections.Client.csproj Makes Microsoft.Extensions references conditional.
src/aspnetcore/src/Servers/Kestrel/Transport.Sockets/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.csproj Removes a redundant Microsoft.Extensions reference.
src/aspnetcore/src/Servers/Kestrel/Transport.Quic/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Quic.csproj Removes redundant Microsoft.Extensions references.
src/aspnetcore/src/Servers/Kestrel/Transport.NamedPipes/src/Microsoft.AspNetCore.Server.Kestrel.Transport.NamedPipes.csproj Removes a redundant Microsoft.Extensions reference.
src/aspnetcore/src/Servers/Kestrel/Core/src/Microsoft.AspNetCore.Server.Kestrel.Core.csproj Removes redundant Microsoft.Extensions references (and normalizes the project header).
src/aspnetcore/src/Servers/IIS/IISIntegration/src/Microsoft.AspNetCore.Server.IISIntegration.csproj Removes redundant Microsoft.Extensions references.
src/aspnetcore/src/Security/CookiePolicy/src/Microsoft.AspNetCore.CookiePolicy.csproj Removes redundant Microsoft.Extensions references.
src/aspnetcore/src/Security/Authorization/Core/src/Microsoft.AspNetCore.Authorization.csproj Makes Microsoft.Extensions references conditional.
src/aspnetcore/src/Security/Authentication/Core/src/Microsoft.AspNetCore.Authentication.csproj Removes a redundant Microsoft.Extensions reference.
src/aspnetcore/src/OpenApi/test/Microsoft.AspNetCore.OpenApi.Tests/Microsoft.AspNetCore.OpenApi.Tests.csproj Removes a redundant Microsoft.Extensions reference.
src/aspnetcore/src/Mvc/test/WebSites/SimpleWebSiteWithWebApplicationBuilderException/SimpleWebSiteWithWebApplicationBuilderException.csproj Removes a redundant Microsoft.Extensions reference.
src/aspnetcore/src/Mvc/test/WebSites/SimpleWebSiteWithWebApplicationBuilder/SimpleWebSiteWithWebApplicationBuilder.csproj Removes a redundant Microsoft.Extensions reference.
src/aspnetcore/src/Mvc/Mvc.TagHelpers/src/Microsoft.AspNetCore.Mvc.TagHelpers.csproj Removes a redundant Microsoft.Extensions reference.
src/aspnetcore/src/Mvc/Mvc.Core/src/Microsoft.AspNetCore.Mvc.Core.csproj Removes redundant Microsoft.Extensions references.
src/aspnetcore/src/Middleware/WebSockets/src/Microsoft.AspNetCore.WebSockets.csproj Removes redundant Microsoft.Extensions references.
src/aspnetcore/src/Middleware/StaticFiles/src/Microsoft.AspNetCore.StaticFiles.csproj Removes redundant Microsoft.Extensions references.
src/aspnetcore/src/Middleware/Session/test/Microsoft.AspNetCore.Session.Tests.csproj Removes a redundant Microsoft.Extensions reference.
src/aspnetcore/src/Middleware/Session/src/Microsoft.AspNetCore.Session.csproj Removes redundant Microsoft.Extensions references.
src/aspnetcore/src/Middleware/Rewrite/src/Microsoft.AspNetCore.Rewrite.csproj Removes redundant Microsoft.Extensions references.
src/aspnetcore/src/Middleware/ResponseCompression/src/Microsoft.AspNetCore.ResponseCompression.csproj Removes redundant Microsoft.Extensions references.
src/aspnetcore/src/Middleware/ResponseCaching/src/Microsoft.AspNetCore.ResponseCaching.csproj Removes a redundant Microsoft.Extensions reference.
src/aspnetcore/src/Middleware/ResponseCaching.Abstractions/src/Microsoft.AspNetCore.ResponseCaching.Abstractions.csproj Removes a redundant Microsoft.Extensions reference.
src/aspnetcore/src/Middleware/RequestDecompression/src/Microsoft.AspNetCore.RequestDecompression.csproj Removes redundant Microsoft.Extensions references.
src/aspnetcore/src/Middleware/RateLimiting/src/Microsoft.AspNetCore.RateLimiting.csproj Removes redundant Microsoft.Extensions references.
src/aspnetcore/src/Middleware/OutputCaching/src/Microsoft.AspNetCore.OutputCaching.csproj Removes a redundant Microsoft.Extensions reference.
src/aspnetcore/src/Middleware/MiddlewareAnalysis/src/Microsoft.AspNetCore.MiddlewareAnalysis.csproj Removes a redundant Microsoft.Extensions reference.
src/aspnetcore/src/Middleware/Microsoft.AspNetCore.OutputCaching.StackExchangeRedis/src/Microsoft.AspNetCore.OutputCaching.StackExchangeRedis.csproj Makes Microsoft.Extensions references conditional.
src/aspnetcore/src/Middleware/Localization/src/Microsoft.AspNetCore.Localization.csproj Removes redundant Microsoft.Extensions references.
src/aspnetcore/src/Middleware/HttpsPolicy/src/Microsoft.AspNetCore.HttpsPolicy.csproj Removes a redundant Microsoft.Extensions reference.
src/aspnetcore/src/Middleware/HttpOverrides/src/Microsoft.AspNetCore.HttpOverrides.csproj Removes redundant Microsoft.Extensions references.
src/aspnetcore/src/Middleware/HttpLogging/src/Microsoft.AspNetCore.HttpLogging.csproj Removes a redundant Microsoft.Extensions reference.
src/aspnetcore/src/Middleware/HostFiltering/src/Microsoft.AspNetCore.HostFiltering.csproj Removes a redundant Microsoft.Extensions reference.
src/aspnetcore/src/Middleware/HealthChecks/src/Microsoft.AspNetCore.Diagnostics.HealthChecks.csproj Removes a redundant Microsoft.Extensions reference.
src/aspnetcore/src/Middleware/Diagnostics/src/Microsoft.AspNetCore.Diagnostics.csproj Removes redundant Microsoft.Extensions references.
src/aspnetcore/src/Middleware/CORS/src/Microsoft.AspNetCore.Cors.csproj Removes redundant Microsoft.Extensions references.
src/aspnetcore/src/Logging.AzureAppServices/test/Microsoft.Extensions.Logging.AzureAppServices.Tests.csproj Makes Microsoft.Extensions references conditional.
src/aspnetcore/src/Logging.AzureAppServices/src/Microsoft.Extensions.Logging.AzureAppServices.csproj Makes Microsoft.Extensions.Logging.Abstractions reference conditional.
src/aspnetcore/src/Localization/Localization/test/Microsoft.Extensions.Localization.Tests/Microsoft.Extensions.Localization.Tests.csproj Makes Microsoft.Extensions references conditional.
src/aspnetcore/src/Localization/Localization/test/Microsoft.Extensions.Localization.RootNamespace.Tests/Microsoft.Extensions.Localization.RootNamespace.Tests.csproj Makes Microsoft.Extensions references conditional.
src/aspnetcore/src/Localization/Localization/src/Microsoft.Extensions.Localization.csproj Makes Microsoft.Extensions references conditional.
src/aspnetcore/src/Identity/Extensions.Stores/src/Microsoft.Extensions.Identity.Stores.csproj Makes Microsoft.Extensions.Caching.Abstractions reference conditional.
src/aspnetcore/src/Identity/Extensions.Core/src/Microsoft.Extensions.Identity.Core.csproj Makes Microsoft.Extensions.Options reference conditional.
src/aspnetcore/src/HttpClientFactory/Polly/test/Microsoft.Extensions.Http.Polly.Tests.csproj Makes Microsoft.Extensions references conditional.
src/aspnetcore/src/Http/Routing/test/UnitTests/Microsoft.AspNetCore.Routing.Tests.csproj Removes a redundant Microsoft.Extensions reference.
src/aspnetcore/src/Http/Routing/src/Microsoft.AspNetCore.Routing.csproj Removes a redundant Microsoft.Extensions reference.
src/aspnetcore/src/Http/Http/src/Microsoft.AspNetCore.Http.csproj Removes a redundant Microsoft.Extensions reference.
src/aspnetcore/src/Http/Http.Features/src/Microsoft.AspNetCore.Http.Features.csproj Removes a redundant Microsoft.Extensions reference.
src/aspnetcore/src/Http/Http.Extensions/src/Microsoft.AspNetCore.Http.Extensions.csproj Removes a redundant Microsoft.Extensions reference.
src/aspnetcore/src/Http/Http.Abstractions/test/Microsoft.AspNetCore.Http.Abstractions.Tests.csproj Removes a redundant Microsoft.Extensions reference.
src/aspnetcore/src/Http/Http.Abstractions/src/Microsoft.AspNetCore.Http.Abstractions.csproj Removes redundant Microsoft.Extensions references.
src/aspnetcore/src/Http/Headers/src/Microsoft.Net.Http.Headers.csproj Removes a redundant Microsoft.Extensions reference.
src/aspnetcore/src/Http/Authentication.Abstractions/src/Microsoft.AspNetCore.Authentication.Abstractions.csproj Removes a redundant Microsoft.Extensions reference.
src/aspnetcore/src/Hosting/Server.Abstractions/src/Microsoft.AspNetCore.Hosting.Server.Abstractions.csproj Removes a redundant Microsoft.Extensions reference.
src/aspnetcore/src/Hosting/Hosting/test/Microsoft.AspNetCore.Hosting.Tests.csproj Removes a redundant Microsoft.Extensions reference.
src/aspnetcore/src/Hosting/Hosting/src/Microsoft.AspNetCore.Hosting.csproj Removes a redundant Microsoft.Extensions reference.
src/aspnetcore/src/Hosting/Abstractions/src/Microsoft.AspNetCore.Hosting.Abstractions.csproj Removes a redundant Microsoft.Extensions reference.
src/aspnetcore/src/HealthChecks/HealthChecks/test/Microsoft.Extensions.Diagnostics.HealthChecks.Tests.csproj Makes Microsoft.Extensions references conditional.
src/aspnetcore/src/HealthChecks/HealthChecks/src/Microsoft.Extensions.Diagnostics.HealthChecks.csproj Makes Microsoft.Extensions references conditional.
src/aspnetcore/src/FileProviders/Embedded/test/Microsoft.Extensions.FileProviders.Embedded.Tests.csproj Makes Microsoft.Extensions.FileProviders.Abstractions reference conditional.
src/aspnetcore/src/FileProviders/Embedded/src/Microsoft.Extensions.FileProviders.Embedded.csproj Makes Microsoft.Extensions.FileProviders.Abstractions reference conditional.
src/aspnetcore/src/DataProtection/DataProtection/src/Microsoft.AspNetCore.DataProtection.csproj Makes Microsoft.Extensions references conditional.
src/aspnetcore/src/Configuration.KeyPerFile/test/Microsoft.Extensions.Configuration.KeyPerFile.Tests.csproj Makes Microsoft.Extensions references conditional.
src/aspnetcore/src/Components/WebAssembly/WebAssembly/test/Microsoft.AspNetCore.Components.WebAssembly.Tests.csproj Removes a redundant Microsoft.Extensions reference.
src/aspnetcore/src/Components/WebAssembly/WebAssembly/src/Microsoft.AspNetCore.Components.WebAssembly.csproj Removes a redundant Microsoft.Extensions reference.
src/aspnetcore/src/Components/Web/src/Microsoft.AspNetCore.Components.Web.csproj Removes redundant Microsoft.Extensions references.
src/aspnetcore/src/Components/Server/test/Microsoft.AspNetCore.Components.Server.Tests.csproj Removes a redundant Microsoft.Extensions reference.
src/aspnetcore/src/Components/Components/src/Microsoft.AspNetCore.Components.csproj Removes redundant Microsoft.Extensions references.
src/aspnetcore/src/Caching/perf/MicroBenchmarks/Microsoft.Extensions.Caching.MicroBenchmarks/Microsoft.Extensions.Caching.MicroBenchmarks.csproj Makes Microsoft.Extensions.DependencyInjection.Abstractions reference conditional.
src/aspnetcore/src/Caching/StackExchangeRedis/test/Microsoft.Extensions.Caching.StackExchangeRedis.Tests.csproj Makes Microsoft.Extensions references conditional.
src/aspnetcore/src/Caching/StackExchangeRedis/src/Microsoft.Extensions.Caching.StackExchangeRedis.csproj Makes Microsoft.Extensions references conditional.
src/aspnetcore/src/Caching/SqlServer/test/Microsoft.Extensions.Caching.SqlServer.Tests.csproj Makes Microsoft.Extensions references conditional.
src/aspnetcore/src/Caching/SqlServer/src/Microsoft.Extensions.Caching.SqlServer.csproj Makes Microsoft.Extensions references conditional.
src/aspnetcore/eng/SharedFramework.External.props Removes moved external refs and adds conditional compilation-only references for older TFMs.
src/arcade/src/Microsoft.DotNet.SharedFramework.Sdk/targets/sharedfx.targets Adjusts runtime pack file-version validation filtering logic.
repo-projects/Directory.Build.targets Enables runtime pack version BuildArgs for source-only builds with transitive runtime references.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread repo-projects/Directory.Build.targets Resolved
ericstj added 5 commits March 9, 2026 14:16
When TreatWarningsAsErrors property is set to true, NuGet will emit its warnings as errors.  This prevents MSBuild's WarnNotAsError from downgrading.  To avoid this we must also set WarningsNotAsErrors to avoid NuGet from raising the error.  We cannot directly set this on the commandline since that would make them global and unable to be overwritten by projects.  This property is commonly mutated, so we cannot set it as global.  To avoid this we create a new property which is our own and is appended.
@ericstj ericstj removed the NO-MERGE The PR is not ready for merge yet (see discussion for detailed reasons) label Mar 31, 2026

@dsplaisted dsplaisted left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good, as far as I can tell. I don't know enough about how references between projects in the runtime and other repos work to give feedback on most of the changes.

It seems like copilot found some instances where parameters added to PowerShell scripts weren't being used.

@ericstj

ericstj commented Apr 2, 2026

Copy link
Copy Markdown
Member Author

It seems like copilot found some instances where parameters added to PowerShell scripts weren't being used.

I'll check on those, I thought they were being passed implicitly to other scripts that were called.

@wtgodbe wtgodbe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@ericstj
ericstj requested a review from wtgodbe April 3, 2026 23:34
@ericstj

ericstj commented Apr 3, 2026

Copy link
Copy Markdown
Member Author

Ok, I removed those. For any other test changes like this we can fix up on the backflow. I intend to babysit all of those.

@dotnet-policy-service
dotnet-policy-service Bot requested a review from a team April 3, 2026 23:36
@ericstj
ericstj merged commit 7c70e36 into dotnet:main Apr 6, 2026
11 checks passed
MichaelSimons added a commit to dotnet/sdk that referenced this pull request Apr 9, 2026
Remove Extensions abstractions DLLs that are now provided by the
NETCore.App shared framework (dotnet/dotnet#5206).

Co-authored-by: Copilot <[email protected]>
MichaelSimons added a commit to dotnet/sdk that referenced this pull request Apr 9, 2026
Add Microsoft.Extensions.Logging.Generators and
Microsoft.Extensions.Options.SourceGeneration analyzers that are now
provided by microsoft.netcore.app.ref (dotnet/dotnet#5206).

Co-authored-by: Copilot <[email protected]>
wtgodbe added a commit to wtgodbe/package-overrides-typeload-repro that referenced this pull request Apr 15, 2026
Old M.E.Logging 2.2.0 references NullScope from M.E.Logging.Abstractions,
which was public in v2.2 but removed in v3.0. On .NET 11, PackageOverrides.txt
(added by dotnet/dotnet#5206) forces the shared framework's v11 assembly,
which doesn't have the type → TypeLoadException.

Co-authored-by: Copilot <[email protected]>
wtgodbe added a commit to wtgodbe/aspnetcore that referenced this pull request Apr 15, 2026
Replace 2.2.0 PackageReferences in InProcessNewShimWebSite with shared
framework References to fix TypeLoadException on .NET 11+ caused by
PackageOverrides.txt (dotnet/dotnet#5206) overriding old
Microsoft.Extensions.* assemblies.

The old packages referenced types (e.g. NullScope) that were removed
in later versions, causing TypeLoadException when the shared framework
forces the v11 assembly.

Also reverts the test quarantine from dotnet#66239 since the root cause is
now addressed.

Changes:
- InProcessNewShimWebSite.csproj: Replace 9 PackageReferences (2.2.0)
  with shared framework References
- IIS.NewShim.FunctionalTests.csproj: Remove internal-build skip/exclude
  (no more vulnerable packages)
- NewShimTests.cs: Relax ANCM version assertion (no longer pinned to
  2.2-era version)
- ShutdownTests.cs, StartupTests.cs: Remove quarantine annotations
  added in dotnet#66239

Co-authored-by: Copilot <[email protected]>
svick added a commit to dotnet/runtime that referenced this pull request Jul 16, 2026
…trimming (#130403)

Fixes #130376

## Summary

In .NET 11, `Microsoft.Extensions.Caching.Abstractions` was added to the
base shared framework (dotnet/dotnet#5206, decision in #67487). As a
result, its assembly is now ILLink-trimmed as part of the framework,
whereas previously it shipped only as an untrimmed NuGet package.

`HybridCacheEntryOptions.ToDistributedCacheEntryOptions()` is `internal`
and has no caller inside its own assembly. Its only consumer is the
`Microsoft.Extensions.Caching.Hybrid` implementation package, which
reaches it via
[`[UnsafeAccessor]`](https://github.com/dotnet/extensions/blob/8ba6add4445e324b9daec87a15aa02b6573ce74a/src/Libraries/Microsoft.Extensions.Caching.Hybrid/Internal/DefaultHybridCache.L2.cs#L275-L276).
The trimmer cannot follow cross-assembly `UnsafeAccessor` references
(they resolve by name at runtime, with no metadata edge), so the method
was trimmed out of the shared-framework build. This surfaces as a
`MissingMethodException` at runtime for the Hybrid cache.

## Fix

- Add `ILLink.Descriptors.xml` to preserve the method (auto-embedded via
`eng/illink.targets`).
- Add a trimming test that mirrors the Hybrid `UnsafeAccessor` access
pattern and returns `100` only when the method resolves.

## Validation

Verified with a full self-contained `TrimMode=full` publish:

- **With** the descriptor: the published app exits `100`; the method is
present in the trimmed assembly.
- **Without** the descriptor: the trimming-test harness reports `[Failed
Test]` with exit code `-532462766` (`0xE0434352`, the
`MissingMethodException`), confirming the test guards the fix.

> [!NOTE]
> This pull request was authored by Copilot (AI).

Co-authored-by: Copilot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants