andrewdavey/cassette — Issue #117: Un-referenced Less files causing crash in release mode
Author: sddaniels
Created: 2011-12-15 17:01:09+00:00
State: open

# Backstory
I'm trying to use the Twitter Bootstrap files to get started with a new project. Instead of using cassette to compile the less code, i'm using a different tool because these files will eventually sit on a different server and be shared by multiple apps. But for now I still have the less files in my project, although they are not referenced in any of the views.

#Problem
Everything works great in debug mode, but when I change things to release mode, it crashes with this exception:

```
[InvalidOperationException: Unsupported object type.]
Jurassic.TypeUtilities.TypeOf(Object obj) +256
anonymous(ScriptEngine , Scope , Object , FunctionInstance , Object[] ) +9236
Jurassic.Library.UserDefinedFunction.CallLateBound(Object thisObject, Object[] argumentValues) +37
Jurassic.Library.ObjectInstance.CallMemberFunction(String functionName, Object[] parameters) +86
Cassette.Stylesheets.CompileResult.CallLateBound(Object thisObject, Object[] argumentValues) +106
anonymous(ScriptEngine , Scope , Object , FunctionInstance , Object[] ) +10706
Jurassic.Library.UserDefinedFunction.CallLateBound(Object thisObject, Object[] argumentValues) +37
Jurassic.Library.ObjectInstance.CallMemberFunction(String functionName, Object[] parameters) +86
Cassette.Stylesheets.LessCompiler.CompileImpl(String lessSource, IFile file) +216

[LessCompileException: Less compile error in ~/Content/lib/forms.less.]
Cassette.Stylesheets.LessCompiler.CompileImpl(String lessSource, IFile file) +449
Cassette.Stylesheets.LessCompiler.Compile(String lessSource, IFile sourceFile) +77
Cassette.BundleProcessing.<>c__DisplayClass1.b__0() +104
Cassette.Stylesheets.ExpandCssUrlsAssetTransformer.ReadCss(Func`1 openSourceStream) +53
Cassette.Stylesheets.<>c__DisplayClass1.b__0() +43
Cassette.AssetBase.OpenStream() +103
Cassette.BundleProcessing.ConcatenatedAsset.WriteAsset(IAsset asset, StreamWriter writer) +54
Cassette.BundleProcessing.ConcatenatedAsset.CopyAssetsIntoSingleStream(IEnumerable`1 assets) +156
Cassette.BundleProcessing.ConcatenatedAsset..ctor(IEnumerable`1 children) +72
Cassette.Bundle.ConcatenateAssets() +42
Cassette.BundleProcessing.ConcatenateAssets.Process(Bundle bundle, CassetteSettings settings) +9
Cassette.BundleProcessing.MutablePipeline`1.Process(T bundle, CassetteSettings settings) +488
Cassette.Stylesheets.StylesheetBundle.Process(CassetteSettings settings) +17
Cassette.Configuration.BundleContainerFactoryBase.ProcessAllBundles(IEnumerable`1 bundles, CassetteSettings settings) +77
Cassette.Configuration.CachedBundleContainerFactory.Create(IEnumerable`1 unprocessedBundles, CassetteSettings settings) +148
Cassette.CassetteApplicationBase.CreateBundleContainer(IEnumerable`1 bundles, CassetteSettings settings, String cacheVersion) +104
Cassette.Web.StartUp.CreateCassetteApplication() +652
Cassette.CassetteApplicationContainer`1.CreateApplication() +67
System.Lazy`1.CreateValue() +361
System.Lazy`1.LazyInitValue() +104
System.Lazy`1.get_Value() +89
Cassette.Web.StartUp.b__0() +14
Cassette.Web.CassetteHttpModule.HttpApplicationPostMapRequestHandler(Object sender, EventArgs e) +82
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +148
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
```

I did a little research to see if I could narrow down what was causing the problem. When I added this file search option to the cassette configuration for my content bundle, everything worked fine again:

```
new FileSearch
{
Pattern = "*.css",
SearchOption = System.IO.SearchOption.AllDirectories
}
```

The problem is that I probably want to use less for the project specific files here as well. If it crashes when trying to do that then I'm out of luck on that front.