SEHException when serializing value types

When implementing ISerializable the MSDN documentation recommends on applying the [SecurityPermissionAttribute(SecurityAction.Demand,SerializationFormatter=true)]
attribute on the GetObjectData method (Check out the FxCop rule).

When trying to serialize a structure with the above CAS attribute on its GetObjectData I got a nasty SEHException. When I removed the CAS attribute serialization worked fine…

I’ve included a test code that produces this exception with this post.
I’ve also sent it to Microsoft to see what’s their take on this bug…

In the meanwhile I commented all the CAS attributes on the GetObjectData methods in the Sharp3D.Math library…

SerializationTest.zip (1.05 KB)

You may also like...