From a6bfc67e8ad486998043795b418bb62189951130 Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Mon, 1 Feb 2016 12:13:48 -0800 Subject: [PATCH] Do not throw exception when DependencyModel does not exist --- src/Microsoft.Extensions.DependencyModel/CompilationLibrary.cs | 1 - src/Microsoft.Extensions.DependencyModel/DependencyContext.cs | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Microsoft.Extensions.DependencyModel/CompilationLibrary.cs b/src/Microsoft.Extensions.DependencyModel/CompilationLibrary.cs index 5eee6fa5a..39bae66bc 100644 --- a/src/Microsoft.Extensions.DependencyModel/CompilationLibrary.cs +++ b/src/Microsoft.Extensions.DependencyModel/CompilationLibrary.cs @@ -28,7 +28,6 @@ namespace Microsoft.Extensions.DependencyModel public IEnumerable ResolveReferencePaths() { var entryAssembly = _entryAssembly.Value; - var entryAssemblyName = entryAssembly.GetName().Name; string basePath; string fullName; diff --git a/src/Microsoft.Extensions.DependencyModel/DependencyContext.cs b/src/Microsoft.Extensions.DependencyModel/DependencyContext.cs index 229a0dbcb..6372a3cd0 100644 --- a/src/Microsoft.Extensions.DependencyModel/DependencyContext.cs +++ b/src/Microsoft.Extensions.DependencyModel/DependencyContext.cs @@ -42,7 +42,7 @@ namespace Microsoft.Extensions.DependencyModel if (stream == null) { - throw new InvalidOperationException("Entry assembly was compiled without `preserveCompilationContext` enabled"); + return null; } using (stream)