我写一个简单的控制台应用程序,它会从测试文件读取XML并将其反序列化到一个对象。
I am writing a simple console application that will read xml from a test file and deserialize it to an object.
var s = File.ReadAllBytes("G:\\Temp\\Publishing\\2.txt");
Stream _response = File.OpenRead("G:\\Temp\\Publishing\\2.txt");
var s = File.ReadAllBytes(@"g:\temp\publishing\2.txt");
var s = File.ReadAllBytes(@"G:\Temp\Publishing\2.txt");
我已经尝试了所有上述的读取文件,它总是会抛出 NotSupportedException异常
与消息
不支持给定路径的格式。
The given path's format is not supported.
什么是上面的路径格式错误?
What is the format-error in the above path?
据引用来源:http://referencesource.microsoft.com/#mscorlib/system/io/filestream.cs#749
NotSupportedException异常
将被抛出,如果指数的:
在你的路径是在第三位置或更高版本。 (人们会期望:
是第二个字符),你肯定没有零宽度组合字符或其他类似的Uni code有心计在源回事?
NotSupportedException
will be thrown if the index of the :
in your path is at the third position or later. (One would expect :
to be the second character) Are you sure there are no zero-width combining characters or other similar Unicode shenanigans going on in your source?