使用fileWriter.Write()时,TargetInvocationException未处理

时间:2016-02-13 03:38:24

标签: vb.net exception filewriter

我在VB.NET中有一个项目,它创建一个图像输入的字节数组,然后创建一个.jpg格式的图像文件。这是代码:

Dim fileWriter As New System.IO.FileStream(filePath,System.IO.FileMode.Create)
fileWriter.Write(imageBuf, 0, imageBuf.Length)
fileWriter.Close()

代码运行后,我在第二行执行后立即收到以下错误:

An unhandled exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll

Additional information: Exception has been thrown by the target of an invocation.

我确实看过这个网站上的类似帖子,但是它们似乎都与我的相关。我很感激您的意见。

谢谢。

0 个答案:

没有答案