Mar 1st, 2011, 09:06 PM
.Net4.0, Interceptor, and BadFormatException
We are attempting to go to VS2010 and .Net4.0. I have a INotifyPropertyChanged mixin that intercepts the setters. These mixins are wrapped around concrete types resulting in DecoratorProxies. We have a situation where we take these proxied types and serialize them using the NewtonSoft JSon serializer. We used this serializer in the past because it doesn't care if the type is proxied or not.
It's not working because the JSON serializer is reflecting into the proxied type with GetType().GetMethods() where I see the setters are of type RuntimeMethodInfo. Of each method described with a RuntimeMethodInfo..., the ReturnParameter and ReturnTypeCustomAttributes both get a BadImageFormatException with a message of "The parameters and the signature of the method don't match."
This isn't the serializer as I can look see the problem just by looking at the proxied type in the debugger.
BadFormatException usually has to do with different framework versions. Am I going to have to do a build of Spring for 4.0 to get this to work? (Maybe I can get by with just Spring.Aop.)