-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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/6.0] Fix Assembly.LoadFrom resolver #70537
Conversation
Path.GetFullPath fails on empty path. Check for empty requestor path earlier. Fixes #67802
I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label. |
Tagging subscribers to this area: @vitek-karas, @agocke, @VSadov Issue DetailsBackport of #67890 to release/6.0 Customer ImpactTestingRiskIMPORTANT: If this change touches code that ships in a NuGet package, please make certain that you have added any necessary package authoring and gotten it explicitly reviewed.
|
Did we hear more people hitting this issue? |
But we should probably fix this regardless because of single-file. Assembly.LoadFrom("lib.dll"); // lib.dll exists so this succeeds.
Assembly.Load("NonExistent"); Normally this throws But even worse (from the bug above): Assembly.LoadFrom("lib.dll");
Type.GetType("MyType,NonExistent"); Normally the |
I updated the issue description to fill in the impact/test/risk sections. |
@danmoseley @jeffschwMSFT do we want this change in July servicing? Asking because the Code Complete due date is today and this does not yet have the cc @mmitche in case we need to wait for this change before starting the build. This can be discussed in tomorrow's Tactics. |
@carlossanlop This was approved this morning. |
@carlossanlop Please merge when ready. |
@carlossanlop is out I believe. |
Backport of #67890 to release/6.0
/cc @agocke @jkotas
Customer Impact
Using
Assembly.LoadFrom
with either single-file or dynamic assembly (any assembly which doesn't have aLocation
) can lead toFileLoadException
caused by theAssembly.LoadFrom
internal implementation.Note that the
LoadFrom
can be called on a real assembly file and succeed, but later on trying to load a dependency for an assembly withoutLocation
can lead to the exception.#69596
#67802
Testing
The fix in .NET 7 has been tested for both the single-file and dynamic assembly case manually.
Risk
Low, the code around the fix didn't change between 6 and 7 and 7 didn't see any regression related to this. Also the fix itself is a simple check to avoid calling
Path
APIs with empty string input.