I have this code to protect my files from deobfuscation:
Assembly asm = Assembly.Load(decFL);
MethodInfo entryPoint = asm.EntryPoint;
entryPoint.Invoke(null, new object[] { new string[] { "[ARGS]", "" } });
Obviously, [ARGS] is replaced by arguments. Now, when I compile my protection "stub" of sorts with the program I want to protect, (targeting v2.0), it crashes when I try to run.
Could not load type 'System.Func`2' from assembly 'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
This is from the line MethodInfo.Invoke. When I compile it against version v4.0, it runs successfully, but no window is shown to indicate the program is running. Instead, it just closes after it reached the MethodInfo.Invoke.
I'm really not sure what is causing this.