chucklu / dependentchecker Goto Github PK
View Code? Open in Web Editor NEWFind all dependents of a specific dependency and list the required dependency version
Find all dependents of a specific dependency and list the required dependency version
Choose dependency and click cancel button will trigger this exception
2021-04-23 10:41:12.087 +08:00 [ERR] System.ArgumentException: The path is not of a legal form.
at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
at System.IO.Path.InternalGetDirectoryName(String path)
at System.IO.Path.GetDirectoryName(String path)
at DependentChecker.MainWindow.FindDependent(String dependencyPath) in C:\Users\clu\source\repos\DependentChecker\DependentChecker\MainWindow.xaml.cs:line 91
at DependentChecker.MainWindow.DependencyChoose_Click(Object sender, RoutedEventArgs e) in C:\Users\clu\source\repos\DependentChecker\DependentChecker\MainWindow.xaml.cs:line 37
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
at System.Windows.Controls.Primitives.ButtonBase.OnClick()
at System.Windows.Controls.Button.OnClick()
Could not load file or assembly 'assembly name' or one of its dependencies. An attempt was made to load a program with an incorrect format.
might need to use the following code to fix this issue
internal static Assembly GetAssemblyByName(AssemblyName assemblyName)
{
Assembly assembly = GetFirstOrDefaultAssembly(assemblyName.FullName);
if (assembly == null)
{
assembly = Assembly.Load(assemblyName);
}
return assembly;
}
private static Assembly GetFirstOrDefaultAssembly(string fullName)
{
Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
return assemblies.FirstOrDefault(a => a.FullName == fullName);
}
2021-04-23 10:31:17.122 +08:00 [ERR] System.IO.FileLoadException: API restriction: The assembly 'bin\Debug\Edenred.Rdc.Pdf.dll' has already loaded from a different location. It cannot be loaded from a new location within the same appdomain.
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)
at System.Reflection.Assembly.ReflectionOnlyLoadFrom(String assemblyFile)
at DependentChecker.MainWindow.SetInfoText(String dependencyPath, Boolean needBindingRedirect) in C:\Users\clu\source\repos\DependentChecker\DependentChecker\MainWindow.xaml.cs:line 63
at DependentChecker.MainWindow.DependencyChoose_Click(Object sender, RoutedEventArgs e) in C:\Users\clu\source\repos\DependentChecker\DependentChecker\MainWindow.xaml.cs:line 38
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
Getting wrong Version from Assembly using Reflection
dotpeek does not have any magic here. It's just a very-very confusing name and behavior for Assembly.LoadFile(string path) method. Assembly.LoadFile() does not actually load the assembly at specified path, it would prefer GAC like described here. You could check the actual path of loaded assembly with ProcessExplorer or similar tool.
If you want to load assembly at exact path for reflection purposes, it's better to use Assembly.ReflectionOnlyLoadFrom() method:
Assembly assembly = Assembly.ReflectionOnlyLoadFrom(f);
In this case assembly.GetName().Version should give you the correct assembly version.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.