You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
FileNotFoundException warning on application startup. #181
I'm getting warnings on application startup when loading assemblies through .AddExtCore(...).
warn: ExtCore.WebApplication[0]
System.IO.FileNotFoundException: Could not load file or assembly 'Portable.BouncyCastle ....
It originates here :
`private void GetAssembliesFromDependencyContext(List assemblies)
{
this.logger.LogInformation("Discovering and loading assemblies from DependencyContext");
foreach (CompilationLibrary compilationLibrary in DependencyContext.Default.CompileLibraries)
{
if (this.IsCandidateCompilationLibrary(compilationLibrary))
{
Assembly assembly = null;
try
{
assembly = AssemblyLoadContext.Default.LoadFromAssemblyName(new AssemblyName(compilationLibrary.Name));
if (!assemblies.Any(a => string.Equals(a.FullName, assembly.FullName, StringComparison.OrdinalIgnoreCase)))
{
assemblies.Add(assembly);
this.logger.LogInformation("Assembly '{0}' is discovered and loaded", assembly.FullName);
}
}
catch (Exception e)
{
this.logger.LogWarning("Error loading assembly '{0}'", compilationLibrary.Name);
this.logger.LogWarning(e.ToString());
}
}
}
}`
It looks like the list DependencyContext.Default.CompileLibraries contains Assembly information and ExtCore is using compilationLibrary.Name as assembly name, but actually, as far as I can tell it's the name of the Package and not the assembly name. When I find my package on the CompileLibrarie list it will contain in the Assemblies collection the correct dll name, but because the above code uses the Name property it cannot find it.
It's more of a question than a bug report as I am no expert on assembly loading and reflection. I don't know if its a bug in ExtCore or something wrong with the nugget package (manifest?).
Repro steps:
New .net core WebApp
add ExtCore.WebApplication
add services.AddExtCore() in startup
add Portable.BouncyCastle (just an example of a package where assembly name is not the same as dll name)
Activity
DmitrySikorsky commentedon Nov 22, 2020
Hi @kostekk88, thank you. Yes, I know about this issue. I think I need to look at it again, because it has been done long time ago.