Don't fail precompiled view discovery if assembly is not managed

This commit is contained in:
Pranav K 2016-10-09 20:39:01 -07:00
parent d09e921c4a
commit 4a1c437f60
1 changed files with 8 additions and 1 deletions

View File

@ -69,7 +69,14 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Compilation
if (File.Exists(precompiledAssemblyFilePath))
{
System.Runtime.Loader.AssemblyLoadContext.Default.LoadFromAssemblyPath(precompiledAssemblyFilePath);
try
{
System.Runtime.Loader.AssemblyLoadContext.Default.LoadFromAssemblyPath(precompiledAssemblyFilePath);
}
catch (FileLoadException)
{
// Don't throw if assembly cannot be loaded. This can happen if the file is not a managed assembly.
}
}
}
#endif