Open ghost opened 6 years ago
A possible workaround for this issue, here #438.
OK, sorry for not finding this before writing.
I've searched a bit through the .NET and AlphaFS code and I think this is caused by AlphaFS always creating the FileStream from handle and not from path. If the FileStream is created from handle the Name property is set to null (https://referencesource.microsoft.com/#mscorlib/system/io/filestream.cs,c49450a04f720cdd).
Maybe this can be worked around somehow?
I think the only way to work around it is if we'd use reflection to set the _fileName
field of the FileStream
instance after creating it. It could be a viable option actually, since this is a quite annoying "bug". What do you think @Yomodo? (We would just need to create tests for this to ensure it doesn't break with new .NET versions, but I find it unlikely that they'd change this).
@alphaleonis Sounds like a plan!
If I call File.Open the returned FileStream object has it's Name property set to '[Unknown]'. With the .NET variant of File.Open this property is set to the file path.