c# - Savefiledialog 的 Stackoverflow 异常

标签 c# winforms savefiledialog

WinForms 应用程序中借助 SaveFileDialog 保存 xml 文件时,我收到 Stackoverflow 异常。代码没什么特别的:

DialogResult result = saveFileDialog.ShowDialog(); 
if (result == DialogResult.OK) 
{
    txtOutputFile.Text = saveFileDialog.FileName;
    // do something
}

它在 ShowDialog() 中立即失败。

只有在输入文件名后在对话框中按 Enter 时,我才会收到它。如果我用鼠标按下保存,一切正常。

我在 Windows 7 机器上收到此异常,在 Windows 10 上试过 - 一切正常。有什么想法吗?

更新:很抱歉,我现在无法在我使用了好几天的机器上重现这个问题(在同一个程序中,没有任何相关更改)。

最佳答案

我发现这个线程试图找到相同问题的修复。

我能够在构建配置管理器中解决针对特定架构的问题。

确保配置设置为 x86x64 而不是 Any CPU

关于c# - Savefiledialog 的 Stackoverflow 异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32603660/

相关文章:

Apple IOS 上的 C# 应用程序

C# 精简多指针的内存读取

python - Python 文件保存错误无效

android - 使用 Intent.ActionOpenDocumentTree 时,您可以允许用户保存在设备以外的位置吗?

c# - wcf 联合安全 token 是 session token 还是可重用的?

c# - Microsoft Hadoop Avro Serializer 不支持 IEnumerable<string>

c# - ProductName 隐藏 System.Windows.Forms.Control.ProductName

c# - 如何在TextBox中自动在2位数字后插入连字符 "-"?

.net - 如何在 DataGridView 中显示 DateTimePicker?

c# - Microsoft.Win32.SaveFileDialog 有效文件名问题