in C++/CLI

2

When I'm trying serialize a class containing this property:

[NonSerialized]
property System::Collections::ObjectModel::ReadOnlyCollection<String^>^ IgnoredWords

I get a compilation error saying:

fatal error C1093: API call 'DefineCustomAttribute' failed '0x801311c0'

How do I tell the serializer that I do not want to serialize this property (and, yes, by default it tries to, which causes a run time error)?

.net
xml-serialization
c++-cli
asked on Stack Overflow Nov 12, 2009 by Dan Byström • edited Mar 22, 2011 by Dan Byström

1 Answer

3

(inferring from xml-serialization tag) You want [XmlIgnore] for XmlSerializer.

[NonSerialized] is for BinaryFormatter etc, and only applies to fields, not properties (which is probably why you are getting DefineCustomAttribute failures).

answered on Stack Overflow Nov 12, 2009 by Marc Gravell

User contributions licensed under CC BY-SA 3.0