SmartAssembly 7

Troubleshooting name mangling

SmartAssembly usually detects that a member cannot be obfuscated by name mangling. However, in some cases, you need to manually exclude the member from the obfuscation. You can do this in your SmartAssembly project or by using custom attributes.

  • If you use the Unicode unprintable characters and advanced renaming algorithm option for name mangling, consider using Unicode unprintable characters instead, especially if your class/interface inheritance is complex or if you use generics.
  • If you are using Linq, you must exclude any classes using the System.Data.Linq.Mapping.Tableattribute from obfuscation and pruning (this also applies if they are used as a dependency).
    Depending on the specific application you many need to exclude other classes.
  • You may experience problems running an assembly that uses name mangling with a merged dependency containing WPF code, especially if that WPF code contains enums.

    To resolve these problems, follow the steps in Troubleshooting after building.

Excluding public members from name mangling

Executable files

By default, SmartAssembly obfuscates all members of executable files, including public members.

To override this behavior, manually edit the SmartAssembly project file (*.saproj) in an XML editor as follows:

  1. Locate the <Assembly> element for the assembly to which you want to apply the setting.
  2. Add the KeepPublicMembersAccessible="1" attribute to the <Merging> element, as in the example below.
<Assembly AssemblyName="...">
  <Merging KeepPublicMembersAccessible="1">
    <!-- Settings for the assembly -->
  </Merging>
</Assembly>

The ExcludePublicMembers attribute on the <Obfuscation> element was replaced by KeepPublicMembersAccessible in SmartAssembly 6.7. Because the new attribute is set on the <Merging> element, the assembly's public members are neither pruned nor obfuscated.

DLL files

SmartAssembly does not obfuscate public members of DLL files, because the DLL would be unusable.

Excluding items from name mangling

If you do not want to obfuscate some members, select the assembly to obfuscate, and navigate to the items that you want to exclude from obfuscation. Items you exclude from obfuscation will not be obfuscated in the resulting assembly.

You can also use the [DoNotObfuscate] and [DoNotObfuscateType] attributes to exclude items from name mangling. For information, see Using custom attributes.


Didn't find what you were looking for?