Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

LoadFromResolve event handler should return null #12329

Merged
merged 1 commit into from
Jun 17, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/mscorlib/src/System/Reflection/Assembly.CoreCLR.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,19 @@ private static Assembly LoadFromResolveHandler(object sender, ResolveEventArgs a
string requestedAssemblyPath = Path.Combine(Path.GetDirectoryName(requestorPath), requestedAssemblyName.Name+".dll");

// Load the dependency via LoadFrom so that it goes through the same path of being in the LoadFrom list.
return Assembly.LoadFrom(requestedAssemblyPath);
Assembly resolvedAssembly = null;

try
{
resolvedAssembly = Assembly.LoadFrom(requestedAssemblyPath);
}
catch(FileNotFoundException)
{
// Catch FileNotFoundException when attempting to resolve assemblies via this handler to account for missing assemblies.
resolvedAssembly = null;
}

return resolvedAssembly;
}

public static Assembly LoadFrom(String assemblyFile)
Expand Down