Use this article to troubleshoot errors that occur while Dotfuscator processes an application.
Dotfuscator Fails to Protect Nullable Reference Types
Add the force_nuget_tools global option to the Dotfuscator configuration file:
<dotfuscator version="2.3">
<global>
<!-- Other option elements -->
<option>force_nuget_tools</option>
</global>
<!-- Other configuration elements -->
</dotfuscator>This option forces Dotfuscator to use newer ILasm and ILdasm NuGet packages instead of the libraries included with .NET Framework 4.x.
Dotfuscator Cannot Find a Reference Assembly
To obtain more information about where Dotfuscator searches for the reference assembly, run Dotfuscator from the command line with:
-v -e -p=bindlog=trueAdd any missing paths to the User Defined Assembly Load Path. You can configure the path:
- In the Dotfuscator configuration XML.
- From the Settings tab in the Config Editor.
Dotfuscator Cannot Find ILasm or ILdasm
This problem may produce errors or warnings such as:
Could not find suitable tools [ILdasm] for "C:\Sample\SampleApp.dll". See the Troubleshooting section of the Dotfuscator User Guide.
Build Error.Loading C:\Sample\SampleApp.exe
Could not find a compatible version of ildasm to run on assembly C:\Sample\SampleApp.exe. This assembly was originally built with .NET Framework v4.0.30319.
Build Error. WARNING: Encountered an invalid path/paths while probing for tools. The paths were "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.7.2 Tools\x64\" and ildasm.exe: The error was "Illegal characters in path.". Ignoring and continuing search. For more detail, define a config property named "toollog" and run Dotfuscator again.These messages indicate that Dotfuscator cannot locate compatible ILasm or ILdasm tools for the assembly it is processing.
Collect Additional Tool Information
To enable additional logging:
- Set Build Progress in the Dotfuscator configuration to Verbose.
- Add a configuration property named toollog with any nonblank value.
- Run the Dotfuscator build again.
When running from the command line, you can instead use:
-v -p:toollog=trueIf you run Dotfuscator through Visual Studio or MSBuild, you may also need to increase the MSBuild verbosity.
The additional messages begin with LOG: and include information about:
- The assembly Dotfuscator is processing.
- The methods Dotfuscator uses to locate the required tools.
Review the Environment
Depending on the application and operating system:
- When running Dotfuscator on Windows to protect an assembly targeting the Windows-only .NET Framework, verify that a suitable .NET Framework SDK is installed.
- When running on macOS or Linux, verify that the environment has internet access.
- When protecting a .NET 5 or later, .NET Core 3 or later, .NET Standard 2.1, or Xamarin assembly, verify that the environment has internet access.
- If you know the locations of compatible ILasm or ILdasm tools, refer to Explicitly Specifying the Tool Locations.
If the logging does not provide enough information to resolve the issue, contact PreEmptive Support.
ILasm or ILdasm Exits with Error Code 127
When running Dotfuscator on Linux, you may encounter:
ildasm returned 127This can indicate that a required dependency library is missing.
Review the build output for a more specific message, such as:
Error while loading shared libraries: libunwind.so.8: cannot open shared object file: No such file or directoryIn this example, the libunwind library must be installed.
Refer to the NuGet Package article for the complete Dotfuscator system requirements and the dependency libraries required on Linux.
Obtain a Dotfuscator Stack Trace
To obtain a stack trace for a Dotfuscator error, run Dotfuscator from the command line with:
-v -eResolve Android Signing Certificate Fingerprint Errors
When injecting a Tamper Check into a Xamarin Android application, you may encounter:
Error: To inject Tamper Check into a Xamarin Android application, the signing certificate's SHA-1 fingerprint must be specified.
Please set the MSBuild property DotfuscatorAndroidSigningCertFingerprint to this value.
Specify the SHA-1 fingerprint of the certificate used to sign the application.
How you provide the fingerprint depends on the integration:
- When using the Dotfuscator MSBuild Targets, set the DotfuscatorAndroidSigningCertFingerprint property in the Xamarin Android project file.
- When using another integration, create an AndroidSigningCertFingerprint configuration property in the Config Editor.
Resolve a False-Positive Xamarin Tamper Check
If the Xamarin Tamper Check reports that the application was modified when it was not, verify that DotfuscatorAndroidSigningCertFingerprint matches the SHA-1 fingerprint of the certificate used to sign the application.
When using the default keystore certificate, the SHA-1 fingerprint varies by host. If the property contains a fingerprint from one host but the application is built on another host, the application can appear to have been tampered with.
To continue using the default keystore certificate, configure DotfuscatorAndroidSigningCertFingerprint with the fingerprint of the default keystore certificate on the host where the application is built.
Resolve Input Mapping File Errors
You may encounter one of the following errors:
- Error: The input mapping file cannot be honored for the listed methods. The current configuration requires that they all have the same name, but they have different names in your input map file.
- Error: The input mapping file cannot be honored for the listed method. The current configuration doesn't allow it to be renamed, but it has a new name in your input map file.
These errors occur when incremental obfuscation uses a mapping file created with the Explicit Method Overrides option enabled.
Before this option was removed, it was enabled by default when:
- The configuration-file version was earlier than 2.2.
- The configuration contained <option>explicitoverrides</option> when the mapping file was created.
To resolve the error, stop using incremental renaming with the current input mapping file.
If you must preserve the names in the existing mapping file, continue using Dotfuscator 4. Ensure that new projects protected with Dotfuscator 4 do not combine incremental renaming with Explicit Method Overrides.
Resolve the System.attributeTargets.System.Runtime Error
When building an application on Ubuntu 22, you may encounter:
Couldn't load external type because its assembly can't be found: System.attributeTargets.System.Runtime.
According to the source article, this error is caused by missing Ubuntu dependencies rather than Dotfuscator. It indicates a conflict involving netstandard-targeting-pack-2.1-8.0 and netstandard-targeting-pack-2.1.
To resolve the issue:
-
Remove netstandard-targeting-pack-2.1-8.0:
sudo apt-get remove netstandard-targeting-pack-2.1-8.0 -
Remove .NET 8:
sudo apt remove 'dotnet*' 'aspnetcore*' 'netstandard*' sudo apt autoremove -
Register the Microsoft package feed:
wget https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb sudo dpkg -i packages-microsoft-prod.deb -
Install the .NET 8 SDK:
sudo apt-get update sudo apt-get install -y apt-transport-https sudo apt-get update sudo apt-get install -y dotnet-sdk-8.0