Answer the question
In order to leave comments, you need to log in
How to make a dynamic call to an obfuscated DLL (all in C#)?
There is a library that I need to dynamically call from the application.
The library is obfuscated through ConfuserEx.
Only the namespace, the class and the main function that I will call are not obfuscated (not renamed).
I call the method (which is not renamed by the obfuscator) like this:
Assembly A = Assembly.LoadFrom(".\Example.dll");
Type ClassType = A.GetType("Namespace.Class", true);
object Obj = Activator.CreateInstance(ClassType);
System.Reflection.MethodInfo MI = ClassType.GetMethod("Main");
MI.Invoke(Obj, null);
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeLoadException: A type load exception has occurred.
at ZMLoader.Loader.Main () [0x00000] in <filename unknown>:0
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0
at ACZM.Module.Initialize () [0x00000] in <filename unknown>:0
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question