调用RichTextBox.LoadFile时的IOException(String path,RichTextBoxStreamType fileType) [英] IOException when calling RichTextBox.LoadFile(String path, RichTextBoxStreamType fileType)

查看:158
本文介绍了调用RichTextBox.LoadFile时的IOException(String path,RichTextBoxStreamType fileType)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

RichTextBox上有一个我不完全理解并想要你的建议的缺陷。当我的应用程序通过调用RichTextBox.LoadFile(字符串路径,RichTextBoxStreamType fileType)将RTF文件加载到富文本框控件时,它有时会遇到
IOException。错误消息显示"不正确的功能"这不是很有帮助,因为它没有指出问题所在。该错误仅发生在Windows 2008 R2上,频率约为1.2%。它永远不会出现在较低版本的操作系统上。异常的堆栈跟踪
如下:



异常类型:System.IO.IOException


消息: 


   功能不正确。


    Stack: 


       在System.IO .__ Error.WinIOError(Int32 errorCode,String maybeFullPath)


        at System.IO.FileStream.ReadCore(Byte [] buffer,Int32 offset,Int32 count)


       在System.IO.FileStream.Read(Byte []数组,Int32偏移量,Int32计数)


       在System.Windows.Forms.RichTextBox.StreamIn(流数据,Int32标志)


       在System.Windows.Forms.RichTextBox.LoadFile(流数据,RichTextBoxStreamType fileType)


       在System.Windows.Forms.RichTextBox.LoadFile(String path,RichTextBoxStreamType fileType)


       在Microsoft.SqlServer.Configuration.InstallWizard.EULAPidView.UpdateLicenseText(String filepath)


       在System.Windows.Forms.Control.OnVisibleChanged(EventArgs e)


       在System.Windows.Forms.Control.OnVisibleChanged(EventArgs e)


       在System.Windows.Forms.Control.WmShowWindow(消息& m)


       在System.Windows.Forms.Control.WndProc(消息& m)


       在System.Windows.Forms.Control.ControlNativeWindow.WndProc(消息& m)


       在System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd,Int32 msg,IntPtr wparam,IntPtr lparam)

解决方案

Hi MingShi,


如果您确认RichTextBox在具有特定频率的较低版本的Windows 2008 R2中可以正常运行,您可以在错误网站上发布错误
http://connect.microsoft.com/VisualStudio ,然后将链接发回此处。


There is a defect on RichTextBox that I don't fully understand and would like your suggestion. When my application loads a RTF file to a rich text box control by calling RichTextBox.LoadFile(String path, RichTextBoxStreamType fileType), it sometimes encounters an IOException. The error message says "Incorrect function" which is not very helpful because it doesn't point out where the problem is. The bug only happens on Windows 2008 R2 at a frequency of ~1.2%. It never occurs on lower version OS's. The stack trace of the exceptions is as follows:

Exception type: System.IO.IOException

Message: 

    Incorrect function.

    Stack: 

        at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)

        at System.IO.FileStream.ReadCore(Byte[] buffer, Int32 offset, Int32 count)

        at System.IO.FileStream.Read(Byte[] array, Int32 offset, Int32 count)

        at System.Windows.Forms.RichTextBox.StreamIn(Stream data, Int32 flags)

        at System.Windows.Forms.RichTextBox.LoadFile(Stream data, RichTextBoxStreamType fileType)

        at System.Windows.Forms.RichTextBox.LoadFile(String path, RichTextBoxStreamType fileType)

        at Microsoft.SqlServer.Configuration.InstallWizard.EULAPidView.UpdateLicenseText(String filepath)

        at System.Windows.Forms.Control.OnVisibleChanged(EventArgs e)

        at System.Windows.Forms.Control.OnVisibleChanged(EventArgs e)

        at System.Windows.Forms.Control.WmShowWindow(Message& m)

        at System.Windows.Forms.Control.WndProc(Message& m)

        at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)

        at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

解决方案

Hi MingShi,

If you confirm that the RichTextBox acts all right in lower version of Windows 2008 R2 with certain frequency , you may post a bug on the bug site http://connect.microsoft.com/VisualStudio , and then post the link back here.


这篇关于调用RichTextBox.LoadFile时的IOException(String path,RichTextBoxStreamType fileType)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆