diff --git a/src/Microsoft.PowerShell.CoreCLR.AssemblyLoadContext/CoreCLR/CorePsAssemblyLoadContext.cs b/src/Microsoft.PowerShell.CoreCLR.AssemblyLoadContext/CoreCLR/CorePsAssemblyLoadContext.cs index 9225655743e..7d6145dfc23 100644 --- a/src/Microsoft.PowerShell.CoreCLR.AssemblyLoadContext/CoreCLR/CorePsAssemblyLoadContext.cs +++ b/src/Microsoft.PowerShell.CoreCLR.AssemblyLoadContext/CoreCLR/CorePsAssemblyLoadContext.cs @@ -250,7 +250,14 @@ 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); + try + { + asmLoaded = Assembly.Load(assemblyName); + } + catch + { + asmLoaded = null; + } if (asmLoaded == null) { @@ -520,4 +527,4 @@ public static void SetPowerShellAssemblyLoadContext([MarshalAs(stringType)]strin } } -#endif \ No newline at end of file +#endif