Skip to main content

Frequently Asked Questions

Exceptions During Build or Manual Obfuscation

ArgumentExcption: An item with same key has already been added. Key:object Item. - Obfuz.ObfusPasses.SymbolObfus.RenameRecordMap:LoadPropertyMapping

Older versions had this issue when defining multiple parameterized properties with the same name (like operator []). Please update to the latest version and delete the old symbol-mapping.xml file (located at Assets/Obfuz/symbol-mapping.xml by default).

IL2CPP build process prints error logs that some types, fields, functions, properties, or events cannot be found. The names of these missing metadata are the original unobfuscated names

The problematic assembly is likely referencing an obfuscated assembly but hasn't been added to the ObfuzSettings.AssemblySettings.NonObfuscatedButReferenceingObfuscatedAssemblies list. If not added to this list, references in these assemblies won't be updated when obfuscated metadata changes, causing errors. See Assembly and Symbol Obfuscation for details.

Obfuscation succeeds during build, but errors occur during IL2CPP code generation

Possible reasons:

  1. The obfuscated DLL generated by Obfuz has bugs
  2. IL2CPP has specific requirements for metadata names that Obfuz didn't meet
  3. Obfuz fixed the issue, but an old symbol-mapping.xml file is forcing it to use invalid or incompatible obfuscation

Solutions:

  1. Delete symbol-mapping.xml
  2. Update Obfuz to the latest version

If still unresolved, please create a reproduction project and report it to us.

[ReflectionCompatiblityDetector] Reflection compatility issue in ...

The Symbol Obfuscation Pass detects potential reflection or logic errors after obfuscating symbol names. Obfuz cannot accurately determine if potentially problematic code is actually faulty. For such errors or warnings, please verify manually. If confirmed safe, you can ignore these logs.

If all code is verified and you want to suppress these logs, disable reflection compatibility detection in ObfuzSettings.SybmolObfusSettings. See Symbol Obfuscation for details.

Exceptions During Runtime

TypeLoadException: Could not resolve type with token 010001ec from typeref (expected class '$a.$d`1' in assembly 'Obfuz.Runtime, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null')

Do not test and run the obfuscated code in the Editor.

In the Editor, the original unobfuscated code of the obfuscated assemblies (including Obfuz.Runtime) already exists. The obfuscated assemblies reference obfuscated types and functions, which will cause runtime errors such as "type not found"!

If you must test it, disable obfuscation for Obfuz.Runtime, then copy the obfuscated assemblies (DLLs) into a new Unity project where the original source code of the obfuscated assemblies has been removed.

exception:The type initializer for '$$Obfuz$RVA$' threw an exception., stack: at ...

This occurs when obfuscated code runs before EncrytionService<T>::Encryptor is initialized. Solution: Initialize EncryptionService<T>::Encryptor first. See [Initialize Encryptor](../manual/encryption.md#initializing encryptor) for details.

Other Questions

Does Obfuz have any limitations on code?

No.

Can Obfuz obfuscate Chinese type names or fields?

Yes.

How much impact does Obfuz have on performance?

All obfuscation passes except Symbol Obfuscation affect performance, but the exact impact varies. If you notice significant performance degradation, consider disabling unnecessary passes or using rules to exclude specific code from obfuscation.