Skip to content

Conversation

afifi-ins
Copy link

@afifi-ins afifi-ins commented Sep 26, 2025

This PR fixes two scenarios where DispatchProxy behaves incorrectly when working with multiple AssemblyLoadContexts (ALCs).
Fixes:

  1. Corrects proxy generation where the second ALC could produce a proxy bound to the wrong interface type, leading to InvalidCastException.
  2. Fixes the case of creating a proxy when the base proxyType is in a non-collectable ALC (in this case the default ALC) and the interface is in a collectable ALC.

Added Unit test to prevent regressions.

Fixes: #109398

@github-actions github-actions bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Sep 26, 2025
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Sep 26, 2025
@afifi-ins afifi-ins force-pushed the DispatchProxyGeneraotor branch from f77dbf4 to eb9aeaf Compare September 26, 2025 20:56
@jkotas jkotas added area-System.Reflection and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Sep 26, 2025
Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-reflection
See info in area-owners.md if you want to be subscribed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-System.Reflection community-contribution Indicates that the PR has been added by a community member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DispatchProxy generates a proxy type implementing the interface from the wrong ALC

3 participants