Please enter the text to find and press Search.

An error occurred during search results load.

Advanced Symbol Renaming Options

Symbol Renaming with Printable Characters

Symbol renaming algorithm uses unprintable Unicode characters by default. But sometimes it may be useful to use printable ASCII characters instead. In order to do that you can use the instructions below. Alternatively you may use symbol names encryption for the same purpose.

Instructions on enabling printable characters for symbol renaming

  1. Open obfuscatable project inside the IDE
  2. Add new source file to the project and call it ObfuscationSettings.cs (for C#) or ObfuscationSettings.vb (for Visual Basic .NET). You may prefer to use another name instead of ObfuscationSettings.cs or ObfuscationSettings.vb
  3. Fill ObfuscationSettings.cs with the following content (C#):

    using System;
    using System.Reflection;
    [assembly: Obfuscation(Feature = "rename symbol names with printable characters", Exclude = false)]

    For Visual Basic .NET, fill ObfuscationSettings.vb with the following content:

    Imports System
    Imports System.Reflection
    <Assembly: Obfuscation(Feature:="rename symbol names with printable characters", Exclude:=False)> 


Please note that printable characters in symbol names can be controlled at the assembly level only. For example, it is impossible to use printable characters for some specific class or method; it is possible to do this just for a whole assembly.

Type Renaming Patterns

Eazfuscator.NET removes the namespaces of renamed types by default. This can lead to some issues when badly written code tries to get a namespace of an renamed type via reflection.

Let's see on example what kind of flawed code can suffer from the absence of namespaces.

Example 4.22. Example code that fails with NullReferenceException when the given type has no namespace

bool IsSystemDataType(Type type)
    if (type != null && type.Namespace.StartsWith("System.Data"))
        return true;
    return false;

As you can see in the sample above, the method can fail with NullReferenceException when type.Namespace property returns null indicating that the given type has no namespace. This issue can be easily fixed if you have access to the source code, but sometimes the flawed code has the binary form only.

To workaround possible problems, a custom type renaming pattern can be defined for an assembly, for a type or for a group of types. The examples below show the possible definitions.

Example 4.23. Add 'b' namespace to all renamed types in assembly

using System;
using System.Reflection;

[assembly: Obfuscation(Feature = "type renaming pattern 'b'.*", Exclude = false)]

Example 4.24. Add 'b' namespace to a class

using System;
using System.Reflection;

namespace App
    [Obfuscation(Feature = "type renaming pattern 'b'.*", Exclude = false)]
    class Class1

Example 4.25. Add 'b' namespace to a group of renamed classes. All classes with 'Impl' name ending are affected

using System;
using System.Reflection;

[assembly: Obfuscation(Feature = "Apply to type *Impl: type renaming pattern 'b'.*", Exclude = false)]


Of course you are free to choose any namespace in a pattern.


An error occurred during page load.
You can try again or go back.