Serialization of a System.Management.ManagementObject

  • Thread starter Thread starter Jean-Francois Hamelin
  • Start date Start date
J

Jean-Francois Hamelin

Hi,

How can I serialize a System.Management.ManagementObject ? When I try it I
received the exception:

Cannot serialize member System.ComponentModel.Component.Site of type
System.ComponentModel.ISite because it is an interface

I know there is a constructor that can initialize a new instance that is
serializable, can I use this? Any examples or good documentation about it?

JF
 
Hi JF,

As for the System.Management.ManagementObject class you mentioned, it is
not serializable because it contains some reference to external object
which is an interfact. That's why we get that exception. And regarding on
the following constructor,

ManagementObject Constructor (SerializationInfo, StreamingContext)

Based on my research, this is a known issue of the current version of the
..net framework's ManagementObject , this constructor is actualy for
internal use and will be hidden by changing the declaration to "protect" in
the next version. So if we really need to serialize such object, we need to
provide a custom wrapper class which copy call the needed data infos from
the ManagementObject instance.

Thanks.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
You're Welcome , JF.

Thanks again for posting here.


Regards,

Steven Cheng
Microsoft Online Support
 
Back
Top