12.5. "Option Strict Off" Compatibility for VB.NET
12.5.1. Introduction
By default, the Visual Basic .NET compiler does not enforce strict data typing and uses late binding to access methods, properties and fields of the classes. This is somehow simplifies the coding for certain kind of people but it has several implications:
- The resulting application has a greater chance of errors during runtime
- Late binding is considerably slower than a direct strongly-typed access
- Late binding may break after obfuscation
That's why a very good advice for Visual Basic .NET programmers is to use Option Strict On
for their programs. Unfortunately, it is not always possible due to legacy code or personal long-term preferences that are hard to change.
12.5.2. Compatibility Mode
Eazfuscator.NET provides a special compatibility mode that allows to workaround the issues with late binding. It comes at the expense of a lower obfuscation coverage but your code remains functional and runs perfectly after obfuscation.
12.5.3. Instructions
Instructions on activating Option Strict Off compatibility mode for VB.NET
-
Open obfuscatable project inside the IDE
-
Add new source file to the project and call it
ObfuscationSettings.vb
. You may prefer to use another name instead ofObfuscationSettings.vb
-
Fill
ObfuscationSettings.vb
with the following content:Imports System
Imports System.Reflection
<Assembly: Obfuscation(Feature:="vb option strict off compatibility", Exclude:=False)>