SerializationException

S

sapsy

hi,
I have a class which uses Microsoft.Win32.RegistryKey
class, and i am trying to Serialize this class but i get the following
Error... anu ponter will be really helpfull..

Message="Type 'Microsoft.Win32.RegistryKey' in Assembly 'mscorlib,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' is
not marked as serializable."



Thanks
Rohit Sapru
 
N

Nicholas Paldino [.NET/C# MVP]

Rohit,

Well, the exception is obvious. The RegistryKey class is not meant to
be serialized.

You will have to tag the field with the NonSerialized attribute, and
then make sure your class will be able to load the information it needs into
that field so that it works correctly when deserialized.
 
J

Jorge

hi,
I have a class which uses Microsoft.Win32.RegistryKey
class, and i am trying to Serialize this class but i get the following
Error... anu ponter will be really helpfull..

Message="Type 'Microsoft.Win32.RegistryKey' in Assembly 'mscorlib,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' is
not marked as serializable."

Thanks
Rohit Sapru


Try to find all references to this type in the object graph and mark
it with the nonserializable attribute.
If you need to serialize this type, you might implement the
ISerializable in the parent object to customize this member
serialization.
 
S

sapsy

Hi,
I just moved my registry declaration from global to method
level and it worked .....

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top