Giter Site home page Giter Site logo

dependentchecker's Introduction

Hi there ๐Ÿ‘‹

GitHub Stats Top Langs

dependentchecker's People

Contributors

chucklu avatar

Watchers

 avatar  avatar

dependentchecker's Issues

ArgumentException: The path is not of a legal form.

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()

Assembly.Load throw exception

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);
		}

FileLoadException: API restriction: The assembly has already loaded from a different location

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)

Could not get correct assembly version from .dll

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.