Delay enumeration of directory until IDirectoryContents enumerated
davidfowl opened this issue · 2 comments
Not sure why we do this inline, but I was profiling the static file middleware and saw enumeration even though it's just checking for directory existence:
I just had a somewhat similar problem in a WebDAV middleware implementation: I just want to check a path validity, and if this path represents a file or a directory.
Calling GetFileInfo
works for the files but not for the directories. So if it fails, I have to call GetDirectoryContents
to check if it is a directory. And of course it enumerates all child entries for nothing in my case.
So just for curiosity, why GetFileInfo
does not return a valid IFileInfo
for a directory? For performance reasons in case of the path is invalid?
Might be room for even more improvement that #237. See #237 (comment)