【问题标题】:RichTextBox.RTF setter throwing System.ArgumentException. File format is not valid in Windows version 1803RichTextBox.RTF 设置器抛出 System.ArgumentException。文件格式在 Windows 版本 1803 中无效
【发布时间】:2019-09-12 12:40:37
【问题描述】:

模拟以下场景重现崩溃:

  1. 启用 Beta: unicode UTF-8 以获得全球语言支持(致 启用开始 => 区域和语言设置 => 相关设置 -> 其他日期、时间和区域设置 => 区域 -> 更改日期, 时间或数字格式 => 选择管理选项卡 => 点击 更改系统区域设置。
  2. 检查 Beta:unicode UTF-8 以获得全球语言支持复选框
  3. 重启系统
  4. 在 Windows 窗体 Application => 添加一个窗体、RichTextBox、Button 和 一个标签 OnButtonClick => 添加下面的行

    richTextBox1.SelectAll();
    richTextBox1.Rtf = richTextBox1.SelectedRtf; //Leads Crash System.ArgumentException: File format is not valid.
    label1.Text = "RichTextBox1.Rtf = " + richTextBox1.Rtf;
    
  5. 如果我们取消选中 Beta:unicode UTF-8 用于全球语言 支持,重启系统就没有问题了。

Windows 版本 1803 出现问题

感谢您对此用例的任何帮助

【问题讨论】:

    标签: windows version richtextbox argumentexception


    【解决方案1】:

    这也是 microsoft build 1803 和 1809 的问题。 可在此处找到变通解决方案。

    https://developercommunity.visualstudio.com/content/problem/544623/issue-caused-by-unicode-utf-8-for-world-wide-langu.html

    【讨论】:

    • 解决方法是什么?我在您链接的页面上看不到任何内容。
    猜你喜欢
    • 1970-01-01
    • 2012-10-16
    • 1970-01-01
    • 2018-03-27
    • 2020-01-20
    • 1970-01-01
    • 2019-01-29
    • 2020-01-26
    • 1970-01-01
    相关资源
    最近更新 更多