Interface "not marked with serializable attribute" exception
Posted
by Joel in Gö
on Stack Overflow
See other posts from Stack Overflow
or by Joel in Gö
Published on 2010-04-22T22:06:25Z
Indexed on
2010/04/22
23:43 UTC
Read the original article
Hit count: 359
I have a very odd exception in my C# app: when trying to deserialize a class containing a generic List<IListMember>
(where list entries are specified by an interface), an exception is thrown reporting that "the type ...IListMember is not marked with the serializable attribute" (phrasing may be slightly different, my VisualStudio is not in English).
Now, interfaces cannot be Serializable; the class actually contained in the list, implementing IListMember, is [Serializable]
; and yes, I have checked that IListMember
is in fact defined as an interface and not accidentally as a class!
I have tried reproducing the exception in a separate test project only containing the class containing the List and the members, but there it serializes and deserializes happily :/
Does anyone have any good ideas about what it could be?
© Stack Overflow or respective owner