将对象图写入 XAML 时出现 StackOverFlow 异常

发布于 2024-10-10 11:26:44 字数 337 浏览 7 评论 0原文

我正在尝试将对象流写入 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

蓝戈者 2024-10-17 11:26:44

肯定是 objectInstance 包含循环引用,而您的编写器不支持它们。

Must be that the objectInstance contains cyclic references and your writer doesn't support them.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文