Virtualization Protection
Protection ID: virtualization
This protection virtualizes your methods to prevent reverse engineering by transforming your code into a framework-optimized format that is extremely difficult to analyze or decompile.
This protection is available in the editions:
Enterprise
How It Works
Shield's virtualization protection uses an advanced approach that's different from traditional virtualization techniques:
- Framework-Adaptive: Automatically adjusts its virtualization strategy based on the target framework (.NET Framework, .NET Core, .NET Standard, etc.)
- Performance-Optimized: Unlike traditional virtualizers that significantly impact performance, Shield's virtualization has minimal impact on execution speed
- High Compatibility: Works across all supported .NET frameworks and platforms
- Advanced Obfuscation: Effectively hides code from decompilers, making it extremely difficult to view or analyze
This protection is especially effective when combined with other Shield protections like control flow obfuscation and constant encryption.
Parameters
The virtualization protection does not require any additional configuration parameters. Simply adding it to your protection configuration is sufficient.
Rules configuration
shield.config.json
{
"protections": {
"virtualization": {}
}
}
Code example
- Original code:
public int CalculateValue(int input)
{
int result = 0;
for (int i = 0; i < input; i++) {
result += i * 2;
}
return result;
}
- After virtualization (decompiled view):
// The decompiled code will be highly obfuscated and nearly impossible to understand
public int CalculateValue(int input)
{
// Complex, virtualized implementation that performs the same function
// but is virtually impossible to reverse engineer
return VMController.Execute(0x7A2D, input);
}
Exclusions
- Exclude with attribute
Include this attribute in your source code:
[Obfuscation(Exclude = false, Feature = "-virtualization")]
- Exclude from the interface
You can exclude this protection from the methods or classes you want using the Shield configuration interface.
When to Use Virtualization
Virtualization protection is ideal for:
- Critical business logic: Algorithms, validation logic, and other intellectual property
- License verification: Methods that verify license validity
- Security checks: Authentication or authorization logic
- Sensitive calculations: Financial, cryptographic, or proprietary algorithms
For optimal protection, combine virtualization with other Shield protections like anti-debugging and control flow obfuscation.
Compatibility
Framework | Compatibility | Comments |
---|---|---|
.NET Core | ✔ | |
.NET Framework | ✔ | |
.NET (up to 8 version) | ✔ | |
.NET Standard | ✔ | |
Xamarin IOS | ✔ | |
Xamarin Android | ✔ | |
Xamarin MacOs | ✔ | |
WPF | ✔ | |
Blazor | ✔ | |
.NET Maui | ✔ | |
Unity | ✔ | |
ASP | ✔ | |
Silverlight | ✔ | |
VBa (Visual Basic) or C# (CSharp) | ✔ | |
WinRT | ✔ |
Shield's virtualization protection is compatible with all versions of .NET. It automatically adapts to the specific framework you're using, whether it's .NET 2.0, .NET 4.7, .NET Core 2.1, or Xamarin.Forms 5.0.