#
Cross-Assembly Obfuscation and Public Type Renaming
#
Overview
When protecting multiple .NET assemblies, renaming public types in one assembly can cause other assemblies that depend on it to fail at runtime. This issue occurs if the dependent assemblies are not protected in the same run as the assembly whose public types are renamed.
#
Why This Happens
When a .NET assembly references another assembly, it stores the exact names of the types, methods, and members it uses.
If these names change during obfuscation (for example, MyLibrary.Customer
becomes a
), any assembly that still references the old names will no longer work.
This is especially common when:
- You protect a library but not the applications or libraries that use it.
- You run .NET Reactor on different assemblies at different times instead of protecting them together.
#
Example Scenario
Before Protection:
App.exe ---> MyLibrary.dll
App.exe
references MyLibrary.dll
's public type Customer
.
After Protection (MyLibrary.dll only):
App.exe ---> MyLibrary.dll
(Customer renamed to a)
App.exe
still looks for Customer
, but it no longer exists --- causing a TypeLoadException or similar runtime error.
#
How to Prevent Problems
- Protect dependent assemblies together
- Add all related assemblies (the ones that reference each other) into the same .NET Reactor project and protect them in a single run.
- Keep public names for shared libraries
- If you must protect assemblies separately, disable renaming for public types and members in libraries that are referenced by assemblies you are not protecting at the same time.
#
Summary
If you rename public types in the specified assemblies, any other assemblies that use them will fail unless they are protected in the same run. Protect them together or keep public names to ensure compatibility.