-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[release/7.0] Do not use ALC name for AssemblyName in DispatchProxy #82807
Conversation
Tagging subscribers to this area: @dotnet/area-system-reflection Issue DetailsBackport of #82754 to release/7.0 DescriptionDispatchProxy uses Reflection.Emit internally and used to use only one In some cases, ALC name could include a path and because of the special characters in the path Customer ImpactThe regression introduced with #62095 in .NET 7.0 and causing failures for some customers when they upgrade from .NET previous versions to 7.0. For now 2 customers reported this issue:
Testing
RiskVery low, the fix is simple, this PR we are just using the same name for each ALC, there were no specific need to pass the
|
Hi, I have just encountered this issue trying to port a WPF app from 6.0 to 7.0. A slightly different failure path (trying to create a DispatchProxy for a type in an assembly loaded using Assembly.LoadFrom(byte[]). Seems to be the same underlying cause of trying to parse a string as an assembly name that looks nothing like an assemblyname. Very much in favour of this being fixed in a 7.0 update, since it's a blocking regression right now. |
Thanks @rwg0 that sounds similar, it would be helpful if you could verify the fix in this PR with your scenario |
src/libraries/System.Reflection.DispatchProxy/src/System/Reflection/DispatchProxyGenerator.cs
Show resolved
Hide resolved
I'm afraid I don't have the knowledge to build a version of the framework with the fix in to try it (or the time right now to learn how). I did go back and debug the original situation to make sure I understood it properly, and it is definitely being caused by the AssemblyLoadContext name ("Assembly.Load(byte[], ...)") tripping up the AssemblyNameParser, which expects Key=Value after the comma. I've worked around for now by creating my own AssemblyLoadContext with no name :) |
@buyaa-n the servicing branch is now open to take changes. What's the status of this PR? Does it only need a sign-off, or does it need to get more feedback addressed? If/when it's ready, please send the email to Tactics requesting approval, if you haven't done so. |
The failure is unrelated and filed an issue #83226 |
@AaronRobinsonMSFT @ericstj @jkotas @steveharter could we get approval so it can get merged? |
Approved by Tactics, |
Backport of #82754 to release/7.0
Issue #80387
Description
DispatchProxy uses Reflection.Emit internally and used to use only one
AssemblyBuilder
for all proxy types. In .NET 7 that fixed with #62095, now it creates a separateAssemblyBuilder
, for eachAssemblyLoadContext
of the proxy type and also uses the ALC name for creatingAssemblyName
In some cases, ALC name could include a path and because of the special characters in the path
AssemblyName
constructor and throws:The given assembly name was invalid
Customer Impact
The regression causing failures for customers when they upgrade from .NET previous versions to 7.0. For now, two customers indirectly impacted by this regression:
Testing
Risk
Very low, the fix is simple, in this PR we are just using the same name for each ALC, there were no specific need to pass the
ALC
name to theAssemblyName
. Do not expect there is a code dependency on this name as this change was introduced just in 7.0.Passing the ALC name could be useful for debugging purposes, we will fix that later appropriately as suggested this fix has a lower risk for porting into 7.0.
CC @ericstj @jeffhandley