I am trying to calculate normal map and bump map of some images. In order to do this, I am using Craig's Utility Library. However when I try to create bump map I am getting an exception saying
"VerificationException was unhandled : Operation could destabilize the runtime".
How can I solve this? The code throws exception in second line (it throws the same exception for normal map too, but this one comes first):
BumpMap bumpMap = new BumpMap();
pic = bumpMap.Create(pic);
That sort of of error usually happens when doing meta-programming (via something like
ILGenerator
), and getting it wrong; for example, issuing a "call" when a "callvirt" was needed, or borking the stack. It sounds to me like simply: a bug in the library. So report it to the author, or investigate it and fit it yourself.It is technically also possible that the C# compiler has a bug and is emitting the wrong code, but that seems relatively unlikely.