Hi everyone, I'm having trouble protecting a C# assembly with VMProtect. The program uses some reflection techniques, and errors occur when it is run after protection. I tried adding the [global::System.Reflection.Obfuscation(Exclude=true, Feature="renaming")] attribute in some places, and this did solve some of the problems.
But I'm not sure if this is a universal solution for all cases, or if there is a simpler, more general approach that can be applied to a larger range of code. Does anyone have any experience or suggestions? Thank you very much!
How to avoid reflection errors when compiling C# assemblies using VMProtect?
-
- Posts: 4
- Joined: Fri Oct 11, 2024 10:00 am
Re: How to avoid reflection errors when compiling C# assemblies using VMProtect?
Send us an example (original EXE + VMP files) that shows your problem.
-
- Posts: 4
- Joined: Fri Oct 11, 2024 10:00 am
Re: How to avoid reflection errors when compiling C# assemblies using VMProtect?
Hello, I am sorry for not replying to your message in time. I have been busy recently. Regarding the example you requested, I currently need some time to prepare. I will try to organize it within the next few days, but since I am also taking care of some other things, there is still a small probability that I may not be able to send it within a few days.
-
- Posts: 4
- Joined: Fri Oct 11, 2024 10:00 am
Re: How to avoid reflection errors when compiling C# assemblies using VMProtect?
Hello, I have put the example you requested in the attachments, please check it.
- Attachments
-
- Test.zip
- (533.38 KiB) Downloaded 597 times
Re: How to avoid reflection errors when compiling C# assemblies using VMProtect?
Just add ObfuscationAttribute before each class that you want to exclude from renaming:
P.S. [assembly::Obfuscation(Exclude=true, Feature="renaming"] excludes ALL classes from renaming even when "Strip Debug Information" is ON.
Code: Select all
[Obfuscation(Exclude=true, Feature="renaming"]
class MyClass {
...
-
- Posts: 4
- Joined: Fri Oct 11, 2024 10:00 am
Re: How to avoid reflection errors when compiling C# assemblies using VMProtect?
So, when applying reflection to assemblies, namespaces, classes, properties, fields, methods, etc., can we ensure that they will not be affected by renaming obfuscation by using the corresponding Obfuscation attribute provided by C#? I want to know the general rules.