Merge pull request #1284 from dotnet/pakrym/dcfix

Fix dependency context bug and add load overload
This commit is contained in:
Pavel Krymets 2016-02-08 13:23:42 -08:00
commit 129bd03098
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)
{