1

In my web app the following call returns true early during application startup, then returns false later for whatever reason:

HostingEnvironment.VirtualPathProvider.DirectoryExists("~/some/existing/directory")

The folder exists and at the same time the following code always correctly returns true:

System.IO.Directory.Exists(HostingEnvironment.MapPath("~/some/existing/directory"))

I have no idea what can affect VirtualPathProvider to change behaviour. The VirtualPathProvider is overridden on application start with a custom implementation but that doesn't override DirectoryExists() and the method actually called all times is System.Web.Hosting.MapPathBasedVirtualPathProvider.

I checked with Process Monitor and the file system operation that happens is the same for the right and the wrong result.

Anybody with an idea what can break DirectoryExists() (and BTW the same happens for FileExists())?

Piedone
  • 2,693
  • 2
  • 24
  • 43
  • Interesting, is it happened in one single http Request or intermittently in more than one single http Request? – Hatjhie Sep 27 '14 at 03:20
  • This is within the same request on app start; then on subsequent requests only the broken version happens. It has to be told though that the startup of this app (Orchard: http://orchardproject.net/) is quite lengthy and complicated; thus I suspect there is something messing up VPP but I'd need a hint what to look for as I can't find any traces. – Piedone Sep 27 '14 at 19:39

0 Answers0