Fix dependency context bug and add load overload

This commit is contained in:
Pavel Krymets 2016-02-05 14:27:09 -08:00
parent 880c141029
commit 029de95d0f
2 changed files with 11 additions and 2 deletions

View file

@ -68,8 +68,12 @@ namespace Microsoft.Extensions.DependencyModel
var libraryAssets = runtime ? export.RuntimeAssemblies : export.CompilationAssemblies;
foreach (var libraryDependency in export.Library.Dependencies)
foreach (var libraryDependenciesGroup in export.Library.Dependencies.GroupBy(d => d.Name))
{
LibraryRange libraryDependency = libraryDependenciesGroup
.OrderByDescending(d => d.Target == LibraryType.ReferenceAssembly)
.First();
Dependency dependency;
if (dependencyLookup.TryGetValue(libraryDependency.Name, out dependency))
{

View file

@ -38,7 +38,12 @@ namespace Microsoft.Extensions.DependencyModel
private static DependencyContext LoadDefault()
{
var entryAssembly = Assembly.GetEntryAssembly();
var stream = entryAssembly?.GetManifestResourceStream(entryAssembly.GetName().Name + DepsResourceSufix);
return Load(entryAssembly);
}
public static DependencyContext Load(Assembly assembly)
{
var stream = assembly.GetManifestResourceStream(assembly.GetName().Name + DepsResourceSufix);
if (stream == null)
{