Empty Path Name Is Not Legal [duplicate]

心不动则不痛 提交于 2019-11-29 11:17:11

That suggests that the filename variable refers to an empty string.

You haven't shown the code that sets the value of filename, but that's the bit to look at.

First of, try and see what you get when you put a Watch on filename, and break at the exception-throwing line. If it's empty, then find out when was it set to the empty string, if it's not empty, then something's very wrong here and it might be the result of another (evil) code piece somewhere.

Next, I'll suggest you use File.readXXXXX to read the file and not a new FileStream. The File class can handle the open-read-close procedure very nicely.

Hope it helps

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