Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,12 @@ protected override Assembly Load(AssemblyName assemblyName)

// Try loading it from the TPA list. All PowerShell dependencies are in the
// TPA list when published with dotnet-cli.
asmLoaded = Assembly.Load(assemblyName);

try
{
asmLoaded = Assembly.Load(assemblyName);
}
// If it wasn't there, try loading from path
if (asmLoaded == null)
catch (FileNotFoundException)
{
asmLoaded = asmFilePath.EndsWith(".ni.dll", StringComparison.OrdinalIgnoreCase)
? LoadFromNativeImagePath(asmFilePath, null)
Expand Down Expand Up @@ -250,9 +252,12 @@ internal Assembly LoadFrom(string assemblyPath)

// Try loading it from the TPA list. All PowerShell dependencies are in the
// TPA list when published with dotnet-cli.
asmLoaded = Assembly.Load(assemblyName);

if (asmLoaded == null)
try
{
asmLoaded = Assembly.Load(assemblyName);
}
// If it wasn't there, try loading from path
catch (FileNotFoundException)
{
// Load the assembly through 'LoadFromNativeImagePath' or 'LoadFromAssemblyPath'
asmLoaded = assemblyPath.EndsWith(".ni.dll", StringComparison.OrdinalIgnoreCase)
Expand Down Expand Up @@ -520,4 +525,4 @@ public static void SetPowerShellAssemblyLoadContext([MarshalAs(stringType)]strin
}
}

#endif
#endif