I’ve just fixed a problem with the Assemblur obfuscator. It’ a nice tool, but it is outdated and it has no support at this moment. We’re using it because one of our customers was happy with it.

The problem was that all of a sudden the obfuscation process started to fail with an “null reference” exception. I had to trace the change history in TFS (boy, was I lucky on this one, as I started to do a linear search instead of a binary one and one of my colleagues remembered me of the second option 🙂

In the end, I’ve found that the following new line of code was causing the problem:

var shape = (ShapeType)Enum.Parse(typeof(ShapeType), tag );

The solution was to implement a custom parsing sequence. Once in place, the obfuscator started to work.

Now I only have to add some new unit tests.I’d love to hear from other people, using other obfuscators, whether they had similar issues when obfuscating code that used the typeof operator.

[Added on 28.05.2013] We’ve run again into trouble with Assemblur.
The faulty code sequence was the following

using (var reader = new System.Resources.ResourceReader(stream))
    return reader.Cast<DictionaryEntry>().Where( i => ((string)i.Key).StartsWith(pattern) );

We had to use the GetEnumerator method of the reader and then explicity enumerate the resources.