This project has moved and is read-only. For the latest updates, please go here.

Error in Less Handler? Less files being rendered as exceptions when loaded.

Sep 21, 2013 at 2:08 AM
Edited Sep 21, 2013 at 2:10 AM
I have been creating a new project, and I have never had trouble with using the LESS bundler outright before, but when I've been using it lately, the resulting less references in my code result in the following rendered CSS files:

/ During the output text content of processed asset an unknown error has occurred. See more details: Exception has been thrown by the target of an invocation. /

This is the only information I get from the site's less files, which is clearly not the CSS it should be.

I checked the less files themselves, and they seem to compile properly, but I am wondering if I am missing something that needs to be added to my web.config file or less files because they are clearly not working.

Any ideas?

EDIT::
I would like to add that I had an older project that was working correctly, and when I updated the Bundler, it also produced the same error. Any advice would be helpful.
Sep 21, 2013 at 8:39 AM
Hello, KnightSwordAG!

In release mode it works?
Sep 21, 2013 at 2:12 PM
In General, not seeing contents of the Web.config and LESS-files difficult to talk about the causes of the error.

As I understood, you are using V8JsEngine? Just in case, read the readme.txt file from the JavaScriptEngineSwitcher.V8 package.
Sep 21, 2013 at 3:02 PM
Honestly, that is something I haven't tried yet, because I was more interested in the bundler's less transforming capabilities at the moment than the bundler as I would ultimately use it. But I can certainly give it a try.

As to providing the web.config file or LESS files, I should clarify. The web.config file hasn't been modified very much after the nuget packages are loaded, so the only settings that are added, apart from the other settings from other NuGet packages is the same: From the earlier project that isn't working now:
      <sectionGroup name="bundleTransformer"><section name="core" type="BundleTransformer.Core.Configuration.CoreSettings, BundleTransformer.Core" />
            <section name="less" type="BundleTransformer.Less.Configuration.LessSettings, BundleTransformer.Less" />
        </sectionGroup>

...

  <httpHandlers>
            <add path="*.less" verb="GET" type="BundleTransformer.Less.HttpHandlers.LessAssetHandler, BundleTransformer.Less" />
        </httpHandlers>

...
    <bundleTransformer xmlns="http://tempuri.org/BundleTransformer.Configuration.xsd">
        <core>
            <css>
                <translators>
                    <add name="NullTranslator" type="BundleTransformer.Core.Translators.NullTranslator, BundleTransformer.Core" enabled="false" />
                    <add name="LessTranslator" type="BundleTransformer.Less.Translators.LessTranslator, BundleTransformer.Less" /></translators>
                <minifiers>
                    <add name="NullMinifier" type="BundleTransformer.Core.Minifiers.NullMinifier, BundleTransformer.Core" />
                </minifiers>
            </css>
            <js>
                <minifiers>
                    <add name="NullMinifier" type="BundleTransformer.Core.Minifiers.NullMinifier, BundleTransformer.Core" />
                </minifiers>
                <translators>
                    <add name="NullTranslator" type="BundleTransformer.Core.Translators.NullTranslator, BundleTransformer.Core" enabled="false" />
                </translators>
            </js>
        </core>
    </bundleTransformer>
These are all the parts, as I understand them, that are configured from the normal nuget package and they are unchanged. As to the LESS files themselves, the older project is using bootstrap's less files, and is also producing the error, so it would appear to be any valid LESS file is transformed this way.

I've not heard of VsJsEngine, but I can certainly look it up and determine if that is the case.

Thank you for the help. Hopefully this provides more information.
Sep 21, 2013 at 3:13 PM
I not found the less element in your settings.

I recommend to read the following discussion - http://bundletransformer.codeplex.com/discussions/456283
Sep 21, 2013 at 3:21 PM
Ahhh, now that gets me somewhere. So the configuration from nuget will not specify these settings, and we will need to supply these settings ourselves? Are there plans for a default JsEngine and load these settings outright?
Sep 21, 2013 at 3:40 PM
No. You should choose the JS engine.
Sep 22, 2013 at 7:03 AM
Gotcha. Thanks so much for your help!