是什么原因造成NotSupportedException异常("不支持&QUOT给定的路径的格式),同时使用有效的路径? [英] What is causing NotSupportedException ("The given path's format is not supported") while using a valid path?

查看:1336
本文介绍了是什么原因造成NotSupportedException异常("不支持&QUOT给定的路径的格式),同时使用有效的路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写一个简单的控制台应用程序,它会从测试文件读取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?

推荐答案

据引用来源:<一href="http://referencesource.microsoft.com/#mscorlib/system/io/filestream.cs#749">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?

这篇关于是什么原因造成NotSupportedException异常(&QUOT;不支持&QUOT给定的路径的格式),同时使用有效的路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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