Reputation: 1487
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");
I have tried all of the above to read the file and it always throws NotSupportedException
with a message
The given path's format is not supported.
What is the format-error in the above path?
Upvotes: 21
Views: 38241
Reputation: 106549
According to the reference source: http://referencesource.microsoft.com/#mscorlib/system/io/filestream.cs#732
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?
Upvotes: 39