SharpScss icon indicating copy to clipboard operation
SharpScss copied to clipboard

[dotnet-sdk-9.0.100-preview.2.24113.6] SharpScss.dll causes application crash when converting scss to css

Open Junjun-zhao opened this issue 11 months ago • 0 comments

When testing 3rd party application which referring to the SharpScss nuget package with the latest .NET 9 build, it stops working after accessing page. It is caused by SharpScss.dll when converting scss to css. The exception from Visual Studio output window is: "Exception thrown: 'SharpScss.ScssException' in SharpScss.dll". Please refer to https://github.com/dotnet/runtime/issues/98646 for more reference.

Reproduction Steps Minimal Repro steps (Demo attached): ConsoleDemo.zip

The machine has dotnet-sdk-9.0.100-preview.2.24113.6 installed.

  1. Create a new console project.
  2. Install SharpScss nuget package.
  3. Copy the following code to Program.cs:
using SharpScss;
var result = Scss.ConvertToCss(@"@import ""foo"";", new ScssOptions()
{
    OutputStyle = ScssOutputStyle.Compressed,
    InputFile = "test.scss",
    TryImport = (ref string file, string path, out string scss, out string map) =>
    {
        scss = "div {color: #FFF;}";
        map = null;
        return true;
    }
});
var css = result.Css.Trim();
Console.WriteLine(css);
Console.ReadKey();
  1. Build the app.
  2. Change the runtime.config file to let the app run against with dotnet-sdk-9.0.100-preview.2.24113.6.
 "framework": {
      "name": "Microsoft.NETCore.App",
      "version": "9.0.0-preview.2.24112.33"
    }
  1. Launch the app.

Expected behavior Launch successfully with converted css output in command window: image

Actual behavior App crashed with stop working prompt window.

Junjun-zhao avatar Feb 27 '24 08:02 Junjun-zhao