Sometimes throwing exception in WebFormVirtualPathProvider class

Topics: Troubleshooting
Dec 2, 2011 at 8:46 AM

Hello, recently during starting Orchard in debug mode sometimes(not always) I've began to get this type of exceptions:

ArgumentException occured
The relative virtual path '../FacebookSDK_V4.2.1 (3)/Bin/Net40/Facebook.dll' is not allowed here.


It occurs in WebFormVirtualPathProvider class, method FileExists:


public override bool FileExists(string virtualPath) {
            return Previous.FileExists(virtualPath); //exception

after that exceptions occurs in class DefaultVirtualPathMonitor, method BindSignal in these lines of code:
var cacheDependency = HostingEnvironment.VirtualPathProvider.GetCacheDependency(
                new[] { virtualPath },

occurs next exception:
Directory '..\src\Orchard.Web\Modules\Orchard.jQuery\Views' does not exist. Failed to start monitoring file changes.

Somebody have any ideas?

Dec 2, 2011 at 6:32 PM

The exception is caught by the code, and we did this because here it's faster than checking if the file exists using the virtual path provider.

Dec 3, 2011 at 3:47 PM

But why it can happen?

After second start in debug mode everything goes ok.

Dec 6, 2011 at 10:18 AM

Thought that the problem was with App_Data folder, I've deleted it, and restarted CMS with connection to my old existing DB, but problem staying.

How can I solve this problem?

Dec 9, 2011 at 2:57 AM

I'm sorry but what problem? Sébastien said that the exception is caught, so how is it a problem?

Dec 9, 2011 at 9:40 AM

The problem lay in execution in debug mode.

When I'm starting my Orchard site in debug mode at first - I have a lot of exceptions like in first post, but after restarting the debug mode - everything is ok. So if I want to debug my site I must to start debug mode twice.

I just wonna see any advices about why this can happen and any recommendations how to fix it up.

Dec 9, 2011 at 9:42 AM

Go into the debug menu, then exceptions and uncheck uncaught exceptions.

Dec 9, 2011 at 9:53 AM

Yep, it's working and it was my fault cause some time ago I have checked to break execution when any CLR Exception is thrown.

Thank you, Bertrand!