.NET Reactor
User guide
×
Menu

Code Virtualization

 
The Common Intermediate Language (CIL) is a set of instructions that are platform independent and are generated by the language-specific compiler (C#, VB.NET...) from the source code. The CIL is platform independent and can be executed on any of the Common Language Infrastructure supported environments such as the .NET runtime or Mono.
The way how the CIL and other metadata is stored must follow a specific standard (ECMA-335). This way tools like .NET Reflector or ILSpy are able to read the CIL instructions and translate the code back to its source language (C#, VB.NET...). 
 
Code Virtualization converts the CIL code into a set of randomized intructions which are intepreted at runtime by our own virtual machine. As there is no standardized procedure to correctly interprete the new instruction set the original CIL instructions can't be reconstructed. Consequently the virtualized code can't be translated back to its source language.
 
As the performance of virtualized methods is significantly decreased, code virtualization should be only applied on selected methods.
 
To enable code virtualization you need to decorate the corresponding methods with the following attribute:
 
    [System.Reflection.ObfuscationAttribute(Feature = "Virtualization", Exclude = false)]
 
 
Example Usage
 
Before:
 
After:
 
The remaining stub code executes the virtual machine.