Serialization Exception

Docking/MDI for WPF Forum

Posted 12 years ago by John Doherty
Version: 11.1.0542
Avatar

I am receiving the following exception when attempting to serialize a DockSite implemented using MVVM. MyModel is serializable. Is there a way around this?

Thanks,

John

System.InvalidOperationException was caught
HResult=-2146233079
Message=Cannot serialize a generic type 'ActiproSoftware.Windows.DeferrableObservableCollection'1[MyModel]'.
Source=PresentationFramework
StackTrace:
at System.Windows.Markup.Primitives.MarkupWriter.VerifyTypeIsSerializable(Type type)
at System.Windows.Markup.Primitives.MarkupWriter.WriteItem(MarkupObject item, Scope scope)
at System.Windows.Markup.Primitives.MarkupWriter.WriteItem(MarkupObject item, Scope scope)
at System.Windows.Markup.Primitives.MarkupWriter.WriteItem(MarkupObject item)
at System.Windows.Markup.Primitives.MarkupWriter.SaveAsXml(XmlWriter writer, MarkupObject item)
at System.Windows.Markup.Primitives.MarkupWriter.SaveAsXml(XmlWriter writer, Object instance)
at System.Windows.Markup.XamlWriter.Save(Object obj, XmlWriter xmlWriter)
at ActiproSoftware.Windows.Serialization.XamlSerializer.SaveToXmlWriter(XmlWriter writer, Object value)
at ActiproSoftware.Windows.Serialization.XamlSerializer.SaveToString(Object value)

Comments (2)

Answer - Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi John,

In your error's case, I don't believe it's possible to serialize generic types with XamlSerializer.  If you make a class that inherits your DeferrableObservableCollection<MyModel> type and use that class instead, it may work around this particular issue.


Actipro Software Support

Posted 12 years ago by John Doherty
Avatar

That worked, thank you!

The latest build of this product (v24.1.2) was released 1 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.