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

@ -68,9 +68,16 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Compilation
precompiledAssemblyFileName); precompiledAssemblyFileName);
if (File.Exists(precompiledAssemblyFilePath)) if (File.Exists(precompiledAssemblyFilePath))
{
try
{ {
System.Runtime.Loader.AssemblyLoadContext.Default.LoadFromAssemblyPath(precompiledAssemblyFilePath); 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 #endif