ligershark / WebOptimizer.Sass

Apache License 2.0
64 stars 26 forks source link

Exceptions from DartSassHost #55

Open timheuer opened 2 years ago

timheuer commented 2 years ago

I just updated my app to the latest package here and now get runtime errors

SassCompilationException: Error: Value cannot be null. (Parameter 'name')
DartSassHost.JsonConverters.CompilationResultConverter.ReadResult(ref Utf8JsonReader reader)
DartSassHost.JsonConverters.CompilationResultConverter.Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
System.Text.Json.Serialization.JsonConverter<T>.TryRead(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options, ref ReadStack state, out T value)
System.Text.Json.Serialization.JsonConverter<T>.ReadCore(ref Utf8JsonReader reader, JsonSerializerOptions options, ref ReadStack state)
System.Text.Json.JsonSerializer.ReadFromSpan<TValue>(ReadOnlySpan<byte> utf8Json, JsonTypeInfo jsonTypeInfo, Nullable<int> actualByteCount)
System.Text.Json.JsonSerializer.ReadFromSpan<TValue>(ReadOnlySpan<char> json, JsonTypeInfo jsonTypeInfo)
System.Text.Json.JsonSerializer.Deserialize<TValue>(string json, JsonSerializerOptions options)
DartSassHost.UnifiedJsonSerializer.DeserializeObject<T>(string json)
DartSassHost.SassCompiler.CompileFile(string inputPath, string outputPath, string sourceMapPath, CompilationOptions options)
WebOptimizer.Sass.Compiler.ExecuteAsync(IAssetContext context)
WebOptimizer.Asset.ExecuteAsync(HttpContext context, IWebOptimizerOptions options)
WebOptimizer.AssetBuilder.BuildAsync(IAsset asset, HttpContext context, IWebOptimizerOptions options)
WebOptimizer.Taghelpers.LinkInlineHrefTagHelper.GetFileContentAsync(string route)
WebOptimizer.Taghelpers.LinkInlineHrefTagHelper.ProcessAsync(TagHelperContext context, TagHelperOutput output)
...

Looking at the DartSassHost project it is not listed as stable by the author

timheuer commented 2 years ago

@Taritsyn

Taritsyn commented 2 years ago

@timheuer What versions of packages are you currently using?

timheuer commented 2 years ago
<PackageReference Include="LigerShark.WebOptimizer.Core" Version="3.0.368" />
<PackageReference Include="LigerShark.WebOptimizer.Sass" Version="3.0.91" />

When it throws exception, it is on a Razor page where I have:

<meta name="description" content="@ViewData["Description"]" />

in the <head> of my layout component.

Taritsyn commented 2 years ago

It is also important to know the versions of the following packages: DartSassHost, JavaScriptEngineSwitcher.V8 and Microsoft.ClearScript.V8.Native.*.

Taritsyn commented 2 years ago

I would also want to know the version of ASP.NET Core and under which operating system the web application run.

Taritsyn commented 2 years ago

It will be very difficult to determine the causes of this error, because from description (Value cannot be null. (Parameter 'name')) it can be seen that it occurred in JS code when calling .NET method.

So far I have not been able to reproduce this error.

Taritsyn commented 2 years ago

@timheuer Did version 3.0.84 of the LigerShark.WebOptimizer.Sass work without errors?

timheuer commented 2 years ago

No the same error applies when I use 3.0.84

ThomasBjallas commented 2 years ago

Any solution for this?

I am getting the same error when upgrading from .NET 6 to .NET 7 RC1

Temoxa commented 1 year ago

Hello!

I also get some error after move project from NET 5.0 to NET 7.0

Current use LigerShark.WebOptimizer.Sass - 3.0.84 ( 3.0.91 too with error)

image

Taritsyn commented 1 year ago

@Temoxa

This is a syntax error in line 21 column 65 of the /scss/landing/main.scss file.

Temoxa commented 1 year ago

@Temoxa

This is a syntax error in line 21 column 65 of the /scss/landing/main.scss file.

Why its worked in NET 5.0 ? Scss file was not modifyed

Also in stacktace error Exceptions from DartSassHost was too

Taritsyn commented 1 year ago

Scss file was not modifyed

Are you sure about this?

Temoxa commented 1 year ago

Scss file was not modifyed

Are you sure about this?

yes, of cource

Taritsyn commented 1 year ago

Hello, @Temoxa!

Try to reproduce this error in the form of demo project and post a link to it in this discussion.

Temoxa commented 1 year ago
SassCompilationException: Error: (0: 0, 1: 0.25rem, 2: 0.5rem, 3: 1rem, 4: 1.5rem, 5: 3rem) isn't a valid CSS value.
at wwwroot/scss/landing/main.scss:30:65 -> $negative-spacers: if( $enable-negative-margins, negativify-map($spacers), null );

as on my screenshot upper

in previos veriosn compiled is OK, maybe error in Bootstrap ?

image

Taritsyn commented 1 year ago

@Temoxa, I initially said that the problem is in SCSS code. It is possible that the new version of the Bootstrap uses a newer version of the Sass language.

For now, try upgrading the DartSassHost package to version 1.0.0 Preview 8. Within a few days I will release a DartSassHost with support for the the Dart Sass version 1.56.1.

Taritsyn commented 1 year ago

Hello, @Temoxa!

Dart Sass Host version 1.0.0 Preview 9 released.

Temoxa commented 1 year ago

Hello, @Temoxa!

Dart Sass Host version 1.0.0 Preview 9 released.

hello! :)

I removed unused function in scss and project successful run

But i will try new version, thanks!