public void LoadNodeFromName(AssemblyDependencyNode node) { if (node.Name == null) { throw new InvalidOperationException("Cannot load assembly from name, the name is empty."); } switch (node.LoadedFromName) { case AssemblyLoadStatus.Loaded: throw new InvalidOperationException("Cannot load assembly from name, it's already loaded."); case AssemblyLoadStatus.Failed: throw new InvalidOperationException("Cannot load assembly from name, previous attempt failed."); } if (node.Loaded) { throw new InvalidOperationException("Cannot load assembly from name, it's already been loaded."); } var assemblyString = node.Name.ToString(); try { Logger.Debug("Loading from name {AssemblyName}.", assemblyString); var assembly = AssemblyMetadataLoader.Load(node.Name); if (assembly.AssemblyName != node.Name.FullName) { Logger.Warning("Requesting the load of [{RequestedAssemblyName}], but obtained [{LoadedAssemblyName}].", node.Name.FullName, assembly.AssemblyName); } node.MarkAsLoadedFromName(assembly); ProcessLoadedNode(node); } catch (Exception ex) { Logger.Debug(ex, "Failed to load from name {AssemblyName}.", assemblyString); node.MarkAsFailedFromName(ex); } }
public IEnumerable <AssemblyDependencyNode> GetDirectDependencies(AssemblyDependencyNode dependant) => _dependencyByNode.TryGetValue(dependant, out var result) ? result : Enumerable.Empty <AssemblyDependencyNode>();