Combinator does not support site applications


I have created application o in test.dev site.


And I'm getting "Error when combining Style files" in logs:

2014-10-07 22:29:50,284 [11] Piedone.Combinator.CombinedResourceManager - Default - Error when combining Style files
System.ArgumentNullException: Value cannot be null.
Parameter name: virtualPath
at System.Web.VirtualPath.Create(String virtualPath, VirtualPathOptions options)
at System.Web.VirtualPathUtility.ToAbsolute(String virtualPath, String applicationPath)
at Piedone.Combinator.Models.CombinatorResource.get_RelativeUrl() in d:\dev\test.dev\subapp\orchard\src\Orchard.Web\Modules\Piedone.Combinator\Models\CombinatorResource.cs:line 53
at Piedone.Combinator.Models.CombinatorResource.get_AbsoluteUrl() in d:\dev\test.dev\subapp\orchard\src\Orchard.Web\Modules\Piedone.Combinator\Models\CombinatorResource.cs:line 44
at Piedone.Combinator.Services.CombinatorService.<ProcessCombinedResources>b__12(CombinatorResource resource) in d:\dev\test.dev\subapp\orchard\src\Orchard.Web\Modules\Piedone.Combinator\Services\CombinatorService.cs:line 340
at System.Linq.Lookup2.Create[TSource](IEnumerable1 source, Func2 keySelector, Func2 elementSelector, IEqualityComparer1 comparer)
at System.Linq.GroupedEnumerable
at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext()
at System.Linq.Enumerable.Count[TSource](IEnumerable
1 source)
at Piedone.Combinator.Services.CombinatorService.ProcessCombinedResources(IEnumerable1 combinedResources, Uri resourceBaseUri) in d:\dev\test.dev\subapp\orchard\src\Orchard.Web\Modules\Piedone.Combinator\Services\CombinatorService.cs:line 342
at Piedone.Combinator.Services.CombinatorService.CombineStylesheets(IList
1 resources, ICombinatorSettings settings) in d:\dev\test.dev\subapp\orchard\src\Orchard.Web\Modules\Piedone.Combinator\Services\CombinatorService.cs:line 60
at Piedone.Combinator.CombinedResourceManager.BuildRequiredResources(String stringResourceType) in d:\dev\test.dev\subapp\orchard\src\Orchard.Web\Modules\Piedone.Combinator\CombinedResourceManager.cs:line 107

I have debugged this problem, and I see that CombinatorResource does not contain application path segment:

That reason why it cannot calculate RelativeVirtualPath by VirtualPathUtility.ToAppRelative


file attachments

Closed Jul 12, 2015 at 1:29 PM by Piedone


musukvl wrote Oct 7, 2014 at 6:51 PM

I have debugged this problem, and I see that CombinatorResource does not contain application path.Image

Piedone wrote Oct 7, 2014 at 9:17 PM

Thanks for the detailed bugreport.

So if I understand correctly the root of the issue is that VirtualPathUtility.ToAppRelative("/Media/Default...", "/o") returns null, right?

musukvl wrote Oct 8, 2014 at 8:23 AM


Looks like this bug reason is my fault, I used wrong url for setUrl:

Piedone wrote Oct 8, 2014 at 8:44 AM

So I can close this issue?

musukvl wrote Oct 8, 2014 at 11:34 AM

I mistaken in define script path, but Combinator failed because of wrong cache file path. As you see there is some unobvious relation between cache path and resource path.
I think, it needs more convenient error message.

Piedone wrote Oct 8, 2014 at 1:47 PM

I'm got lost. So why did you changing the files in the manifest fix the issue? And what did you change them from?

musukvl wrote Oct 8, 2014 at 1:49 PM

.SetUrl("/Themes/MyTheme/Content/script.js") - is wrong, it needs to be

.SetUrl("/o/Themes/MyTheme/Content/script.js") for /o/ application.

Changing manifest fixes issue.

musukvl wrote Oct 8, 2014 at 2:14 PM

Try to install this theme, add Orchard to subapplication, like it shown on my first screenshot.
So you will see exceptions in errorlog.

But if you change this:

to following:


everything will be ok.

musukvl wrote Oct 8, 2014 at 2:14 PM

check MyTheme.zip

musukvl wrote Oct 8, 2014 at 2:37 PM

Also, I see here another issue:

See my site:
I want to use http://test.dev/css/style.css in Orchard Theme with relations, but Orchard located in /o/ subapplication.
As I understand SetUrl just sets url to Style definition, so if I'm setting manifest.DefineStyle("ES_Style").SetUrl("/css/style.css");
I'm expecting <link href="/css/style.css" rel="stylesheet" type="text/css" /> should be inserted to HTML.
And so it works in Orchard. But when I'm enabling Combinator it fails.
In my point of view, Combinator should be transparent maximum as it is possible. Or it will be nice to get the exception like: "Style /css/style.css content is inaccessible, please add it to ignore list".

However, /css/style.css serverpath can be reached by

Piedone wrote Oct 8, 2014 at 3:22 PM

Start your paths with the tilde instead, i.e. manifest.DefineScript("ES_Script").SetUrl("~/Themes/MyTheme/Content/myscript.js"); The tilde will make it include the app path.

The strange symptom is that the cached file's path doesn't start with /o and that's because the app path isn't set to /o. Combinator can't do anything about that. This is the root cause of your problems.

Running Orchard from a sub-app is kind of hackish and I'd suggest you not to try to do it.

musukvl wrote Oct 8, 2014 at 3:52 PM

Start your paths with the tilde instead, i.e.
Yes, I have done that.
But problem is in relation between cache file and resource file. Why this relation exists? Why tilda in resource files affects path to cache? In my point of view cache file should be indepenent entity.
Running Orchard as sub-app is a not a hack. It is the good way to integrate Orchard to existing application.
Also hostings, like discountasp.net hosts sites in sub-apps.

Piedone wrote Oct 8, 2014 at 8:49 PM

There is no connection between the path of the cache file and the original file. The issue here is that VirtualPathUtility.ToAppRelative("/Media/Default...", "/o") returns null. Now this is not something Combinator can deal with: the first argument is ultimately produced by Orchard (generated with virtual paths) and the second one from ASP.NET. Something is not right here in the setup if this is not working as intended.