Skip to content

Upgrade IIS NewShim tests from 2.2 packages to shared framework#66332

Draft
wtgodbe wants to merge 7 commits intodotnet:mainfrom
wtgodbe:wtgodbe/upgrade-newshim-from-2.2-to-shared-framework
Draft

Upgrade IIS NewShim tests from 2.2 packages to shared framework#66332
wtgodbe wants to merge 7 commits intodotnet:mainfrom
wtgodbe:wtgodbe/upgrade-newshim-from-2.2-to-shared-framework

Conversation

@wtgodbe
Copy link
Copy Markdown
Member

@wtgodbe wtgodbe commented Apr 15, 2026

Summary

Replace 2.2.0 PackageReference items in InProcessNewShimWebSite with shared framework Reference items to fix TypeLoadException on .NET 11+ caused by PackageOverrides.txt (dotnet/dotnet#5206).

Problem

PR dotnet/dotnet#5206 added Microsoft.Extensions.*.Abstractions packages to the shared framework's PackageOverrides.txt. When old code (compiled against M.E.Logging 2.2.0) runs on .NET 11, the shared framework overrides Microsoft.Extensions.Logging.Abstractions with v11.x. The old Logger.BeginScope() references NullScope — a type that was public in v2.2 but removed in v3.0 — causing TypeLoadException.

Repro: https://github.com/wtgodbe/package-overrides-typeload-repro

Changes

  • InProcessNewShimWebSite.csproj: Replace 9 PackageReference items (2.2.0) with shared framework Reference items. Remove ExcludeFromBuild for internal builds (no more vulnerable packages).
  • IIS.NewShim.FunctionalTests.csproj: Remove internal-build SkipTests/ExcludeFromBuild (no more vulnerable packages).
  • NewShimTests.cs: Relax ANCM version assertion from hard-coded 12.2.19169.6 to Assert.NotNull (no longer pinned to 2.2-era ANCM).
  • ShutdownTests.cs, StartupTests.cs: Remove [QuarantinedTest] annotations added in [main] Source code updates from dotnet/dotnet #66239 since the root cause is now addressed.

Notes

  • The FORWARDCOMPAT define is kept so the test app continues to exercise old-style WebHostBuilder code paths.
  • IIS.NewHandler.FunctionalTests is not touched — it references Microsoft.AspNetCore.AspNetCoreModuleV2 2.2.0 (a native ANCM package, different failure mode).

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 <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 15, 2026 22:09
@github-actions github-actions bot added the area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions label Apr 15, 2026
@wtgodbe wtgodbe marked this pull request as draft April 15, 2026 22:10
Copy link
Copy Markdown
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

Updates the IIS NewShim functional test app and tests to avoid .NET 11+ PackageOverrides.txt type-loading failures caused by restoring legacy 2.2-era Microsoft.Extensions.* packages, while keeping the NewShim scenario coverage.

Changes:

  • Replace 2.2 PackageReference dependencies in InProcessNewShimWebSite with shared-framework assembly references.
  • Remove internal-build skip/exclude flags now that vulnerable package restores are no longer needed.
  • Loosen the in-process handler version assertion and unquarantine related IIS long tests for the NewShim configuration.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/Servers/IIS/IIS/test/testassets/InProcessNewShimWebSite/InProcessNewShimWebSite.csproj Removes 2.2 package restores and switches to assembly references to avoid PackageOverrides.txt conflicts on .NET 11+.
src/Servers/IIS/IIS/test/IIS.NewShim.FunctionalTests/IIS.NewShim.FunctionalTests.csproj Stops skipping/excluding NewShim tests in internal builds.
src/Servers/IIS/IIS/test/IIS.NewShim.FunctionalTests/NewShimTests.cs Removes hard-coded ANCM module version pin; validates presence instead.
src/Servers/IIS/IIS/test/Common.LongTests/StartupTests.cs Removes NewShim-specific quarantines now that the underlying failure is addressed.
src/Servers/IIS/IIS/test/Common.LongTests/ShutdownTests.cs Removes NewShim-specific quarantines now that the underlying failure is addressed.

wtgodbe and others added 6 commits April 15, 2026 15:31
The InProcessNewShimWebSite compiles shared source from InProcessWebSite
which uses Microsoft.AspNetCore.Authentication, HttpSys, WebSockets, etc.
The old 2.2 packages pulled these in transitively; with shared framework
References we need to list them explicitly.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
FORWARDCOMPAT blocks intentionally use old APIs (IHostingEnvironment,
IApplicationLifetime, IHttpBufferingFeature) to exercise legacy code
paths. These were not marked obsolete in the 2.2 packages but are in
the current shared framework.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
IAuthenticationSchemeProvider is in Authentication.Abstractions, needed
by Startup.cs shared code.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add Kestrel.Transport.NamedPipes, Kestrel.Transport.Quic, and
Extensions.Http to match the full InProcessWebSite reference set.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
IHttpBufferingFeature was removed from the shared framework. Use the
modern IHttpResponseBodyFeature.DisableBuffering() for both FORWARDCOMPAT
and non-FORWARDCOMPAT code paths.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants