This project has moved. For the latest updates, please go here.


Obfuscator sometimes hangs when doing string hiding


One of my DLLs was not being obfuscated. It hangs when doing string hiding. I debugged the code and reached these lines in AssemblyInfo.cs:
        private void CleanPool (List<Node<TypeDefinition>> pool, List<TypeDefinition> result)
            while (pool.Count > 0) {
                var toRemoved = new List<Node<TypeDefinition>> ();
                foreach (var node in pool) {
                    if (node.Parents.Count == 0) { // line 384

                        toRemoved.Add (node);
                        if (result.Contains (node.Definition))

                        result.Add (node.Definition);

                foreach (var remove in toRemoved) {
                    pool.Remove (remove);
                    foreach (var child in remove.Children) {
                        if (result.Contains (child.Definition))

                        child.Parents.Remove (remove);
This code hangs forever when I a node has itself as parent and child. I couldn´t figure out why or when it occurs (not easy to track because types are already obfuscated at this point), all I know is that it happened to one of my DLLs. It stopped hanging after I change line 384:
        if (node.Parents.Count == 0 || (node.Children.Count == 1 && node.Parents[0] == node.Children[0]))
Not very nice, however it appears to have solved my problem.
Closed Jun 20, 2014 at 6:07 AM by lextm
Cannot reproduce.


lextm wrote Jun 1, 2014 at 2:12 AM

The "a node has itself as parent and child" case is so rare, and I don't know what kind of code can lead the compiler to generate such assemblies. Thus, more information is required for further analysis.