ISerializable on value types

From: Eran Kampf (tentacle_at_zahav.net.il)
Date: 09/22/04


Date: Wed, 22 Sep 2004 19:47:24 +0200

I noticed this wierd problem when implementing ISerializable for a value
type.
The MSDN documentation (and FxCop) say The GetObjectData method should be
marked with [SecurityPermissionAttribute(SecurityAction.Demand,
SerializationFormatter=true)]
(http://www.gotdotnet.com/team/fxcop/docs/rules/SecurityRules/GetObjectData.html).

When I mark my value type's GetMethodData method with the above CAS
deleration I get a wierd SEHException during serialization.
Without the above CAS decleration, serialization\deserialization runs
fine...

Reference types on the other hand work fine with the above CAS
decleration...

Any idea why this is happening?

Eran Kampf
http://www.ekampf.com



Relevant Pages

  • ISerializable on value types
    ... The MSDN documentation (and FxCop) say The GetObjectData method should be ... When I mark my value type's GetMethodData method with the above CAS ... Without the above CAS decleration, ...
    (microsoft.public.dotnet.languages.csharp)
  • ISerializable on value types
    ... The MSDN documentation (and FxCop) say The GetObjectData method should be ... When I mark my value type's GetMethodData method with the above CAS ... Without the above CAS decleration, ...
    (microsoft.public.dotnet.general)
  • ISerializable on value types
    ... The MSDN documentation (and FxCop) say The GetObjectData method should be ... When I mark my value type's GetMethodData method with the above CAS ... Without the above CAS decleration, ...
    (microsoft.public.dotnet.framework.clr)

Quantcast