[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.LoadFromwith either single-file or dynamic assembly (any assembly which doesn't have aLocation) can lead toFileLoadExceptioncaused by theAssembly.LoadFrominternal implementation.Note that the
LoadFromcan be called on a real assembly file and succeed, but later on trying to load a dependency for an assembly withoutLocationcan 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
PathAPIs with empty string input.