I've encountered this exception, when tried to serialize empty ObservableCollection. Non-empty collection was serialized smoothly.
To fix it, create a wrapper class.
To fix it, create a wrapper class.
public class StringObservableCollection : ObservableCollection<string>
{
}
// ...
var collection = new StringObservableCollection();
System.Windows.Markup.XamlWriter.Save(collection);