Most of my day today was tracking down a problem with our app when we obfuscated it. We were getting a System.EntryPointNotFoundException in the obfuscated version, while the normal one worked fine. The stack trace contained the following on the top of the stack trace:
at System.Collections.Generic.IEnumerable`1.GetEnumerator() +0
No concrete class, and an assembly code offset of 0. Weird, eh? After tweaking with lots of settings and digging through the IL of several iterations of differing obfuscation techniques, I finally determined the problem.
I had three overloads of a method that each took a different parametrization of IEnumerable<T>. For the sake of example, we'll say IEnumerable<A>, IEnumerable<B>, and IEnumerable<C>. In the obfuscation process, calls to any of the three were being changed to the IEnumerable<A> overload. Sure enough, PEVerify was giving errors about the wrong type being on the stack. (I was going to show the IL before and after, but I just realized that I deleted the non-working one after fixing it. I'll post it if I can find it again) It seems that Dotfuscator was not distinguishing properly between overloads if they only differ by parameterization types. I have not verified it, but this may have been aggravated by iterator methods.
We're working up some sample code to send to Preemptive so they can address the problem, but debugging it was frustrating enough to post a synopsis of the account for Google to find.
Remember Me
Page rendered at Monday, September 08, 2008 7:42:01 AM (Pacific Standard Time, UTC-08:00)
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.