Taritsyn / BundleTransformer

Bundle Transformer - a modular extension for System.Web.Optimization (also known as the Microsoft ASP.NET Web Optimization Framework).
Apache License 2.0
130 stars 19 forks source link

Problem with updates to latest version of SassAndScss #56

Closed trevski closed 2 years ago

trevski commented 2 years ago

We are running locally on IIS on Windows 10. We are upgrading our project to run on Bootstrap5 using SASS and moving away from .less. Initially SASS was working but then I decided to clean up the nuget packages and upgrade to the latest version. 1.12.36 and LibSassHost 1.3.3

We are now getting a very unhelpful error message.

Exception has been thrown by the target of an invocation.

[HttpException (0x80004005): 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.] BundleTransformer.Core.HttpHandlers.AssetHandlerBase.ProcessRequest(HttpContextBase context) +1619 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +542 System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +75 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +93

Can you provide any ideas as to how we might debug?

Taritsyn commented 2 years ago

Hello, Trevor!

Have you installed the LibSassHost.Native.win-x86 and LibSassHost.Native.win-x64 packages?

trevski commented 2 years ago

Only x64

Taritsyn commented 2 years ago

Is the process definitely not 32-bit?

trevski commented 2 years ago

I have installed x86 and still have the same issue. I am running Visual Studio Enterprise 2022 so I assumed we were debugging in x64.

trevski commented 2 years ago

Screenshot 2022-04-18 105013 Screenshot of my packages file for reference

Taritsyn commented 2 years ago

It is very similar to absence of some dependency or usage of incompatible versions of assemblies.

If I were you, I would uninstall all NuGet packages, and then install only the necessary ones. In the latest versions of Visual Studio, error often occur when updating packages in the legacy ASP.NET projects (see the “Need BundleTransformer.NUglify new package release” and “Updating System.Buffers in .Net Framework project breaks dll-mapping to libsasshost version” issues).

trevski commented 2 years ago

I believe that is exactly what I have done, although I have other code that requires an update to Newtonsoft which is now on version 13.

Is there any way of telling which assembly is incompatible ?

Taritsyn commented 2 years ago

Is there any way of telling which assembly is incompatible?

It's hard to say, but the LibSassHost doesn't use the Json.NET library.

It is also possible that an error at the interop level and occurs when reading files. Try translate a simple SCSS-file without imports instead of the Bootstrap.

trevski commented 2 years ago

One of the dependencies is WebGrease which does require Json.Net

I've done a clean install as you have suggested.

System.Buffers needed to be pushed to latest version 4.5.1 Microsoft.Web.Infrastructure needed to be pushed to 2.0.0

in order for the project to compile

I then found an error here

with a clash on my machine level web.config which I suspect was the root of the issue.

It is now resolved thank you for your help.

trevski commented 2 years ago

Happy to close thank you for your help again.

trevski commented 2 years ago

Quick questions, which css minifier would you recommend ?

Taritsyn commented 2 years ago

BundleTransformer.NUglify it is a modern replacement for the BundleTransformer.MicrosoftAjax module.