我在按钮点击事件处理程序上调用方法时收到此错误:
发生了<。> System.Runtime.Serialization.InvalidDataContractException' mscorlib.dll但未在用户代码中处理
这是我的经纪人:
private async Task WriteAsync()
{
var objectGraph = getObjectGraph();
var serializer = new DataContractSerializer(typeof(List<Car>));
using (var stream = await ApplicationData.Current.LocalFolder.OpenStreamForWriteAsync(myFile, CreationCollisionOption.ReplaceExisting))
{
serializer.WriteObject(stream, objectGraph);
}
txt.Text = "Write Succeed !!!";
}