Sounds to me as though you've stored the results of calling an enumerator method without converting the result to a list.
When you have a method like this:
public IEnumerable<string> GetMyWidgetNames()
{
foreach (var x in MyWidgets)
{
yield return x.Name;
}
}
The compiler turns this into a nested object with a name like the one you're seeing (one with a name you could never create yourself because of the embedded +
)
If you then store a reference to this object inside something you try to serialise, you'll get the exception noted by the OP.
The "fix" is to ensure that your serialised objects always convert any IEnumerable<> assignments into lists. Instead of this
public IEnumerable<string> WidgetNames { get; set; }
you need to write:
public IEnumerable<string> WidgetNames
{
get { return mWidgetNames; }
set
{
if (value == null)
mWidgetNames= null
else mWidgetNames= value.ToList();
}
}
private List<string> mWidgetNames;