将对象图写入 XAML 时出现 StackOverFlow 异常
我正在尝试将对象流写入 XAML 文件,但最终出现 StackoverFlowException 。 在 CallStack 中,我可以看到“已超出 Visual Studio 支持的最大堆栈帧数”,
这是我尝试执行的代码片段。
StreamWriter xamlStream =new StreamWriter(File.OpenWrite("a.xaml"));
string myXaml = System.Windows.Markup.XamlWriter.Save(objectInstance);
xamlStream.Write(myXaml);
谢谢 ...!
I am trying to Write an object stream into a XAML file but i end up in StackoverFlowException .
In the CallStack i could see "The maximum number of stack frames supported by Visual Studio has been exceeded"
This is the piece of code i'm trying to execute.
StreamWriter xamlStream =new StreamWriter(File.OpenWrite("a.xaml"));
string myXaml = System.Windows.Markup.XamlWriter.Save(objectInstance);
xamlStream.Write(myXaml);
Thanks ...!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
肯定是 objectInstance 包含循环引用,而您的编写器不支持它们。
Must be that the objectInstance contains cyclic references and your writer doesn't support them.