RichTextBox.RTF setter throwing System.ArgumentException. File format is not valid in Windows version 1803

狂风中的少年 提交于 2020-01-24 20:58:07

问题


The following scenario is simulated to reproduce the crash:

  1. Enable Beta: unicode UTF-8 for world wide language support (To enable Start=> Region & Language settings => Related settings -> Additional date, time & regional settings => Region -> Change date, time or number formats => select Administrative tab => Click on Change System Locale.
  2. Check Beta: unicode UTF-8 for world wide language support checkbox
  3. Restart the system
  4. In Windows forms Application => Add a form, RichTextBox, Button and a label OnButtonClick => add below lines

    richTextBox1.SelectAll();
    richTextBox1.Rtf = richTextBox1.SelectedRtf; //Leads Crash System.ArgumentException: File format is not valid.
    label1.Text = "RichTextBox1.Rtf = " + richTextBox1.Rtf;
    
  5. If we UnCheck Beta: unicode UTF-8 for world wide language support, and restart the system there was no issue.

Issue is observed with windows version 1803

Any help on this use case is appreciated


回答1:


It is an issue from microsoft build 1803 and 1809 as well. Work around solution can be found here.

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



来源:https://stackoverflow.com/questions/55809339/richtextbox-rtf-setter-throwing-system-argumentexception-file-format-is-not-val

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!