ReflectPropertyDescriptor problem

  • Thread starter Thread starter Anthony Sox
  • Start date Start date
A

Anthony Sox

hi all,

i have a client application that calls a server component to get a
list/collection/array of objects that implement INotifyPropertyChanged
interface. when i make changes to the object and try to udate the server i
get the following error message

Type 'System.ComponentModel.ReflectPropertyDescriptor' in Assembly 'System,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' is not
marked as serializable.

if i comment out AddHandler routine of my custom PropertyChanged event it
works fine but my UI nolonger gets notification. if i search for
ReflectPropertyDescriptor using my object browser i do not find it.

can someone help i am going nuts.
 
Hi Anthony,

It sounds like you might be using remoting and/or binary serialization ?
The problem is when you listen to the event (AddHandler) the object you are
listening to gets a reference to your object that is listening, and if that
cannot be marshaled then you get the error.
If you can modify the server and the classes that implement
INotifyPropertyChanged, change the event to a Custom event, and attribute
the backing field as non seriazable.

For an opinion and discussion on Custom Events with some relevant links see
my blog entry:
http://msmvps.com/blogs/bill/archive/2004/08/08/11438.aspx

For an example of a Custom event for this particular purpose, see Rocky's
blog (linked to in the above link)
http://www.lhotka.net/WeBlog/PermaLink.aspx?guid=8f8ae33f-f3b3-4864-a146-4f852d78783e
and his earlier explanation of the issue:
http://www.lhotka.net/WeBlog/PermaLink.aspx?guid=776f44e8-aaec-4845-b649-e0d840e6de2c
 
Back
Top