ArgumentOutOfRangeException: A valid UTF32 value is between 0x000000 and 0x10ffff, inclusive, and should not include surrogate codepoint values

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
2 years ago
this is a bug that I just installed the project for the developer, Style.css cannot load
please, help me

I'm using VS2022, Installed .net runtime and SDK 6.0, MS SQL 18, NopEcommerce lastest version

this file cannot load -> https://localhost:5001/css/Homepage.Head.styles.css?v=StCwVdFgQysRjXbNVrIruZ78zSo net::ERR_ABORTED 500

ArgumentOutOfRangeException: A valid UTF32 value is between 0x000000 and 0x10ffff, inclusive, and should not include surrogate codepoint values (0x00d800 ~ 0x00dfff). (Parameter 'utf32')
char.ConvertFromUtf32(int utf32)
NUglify.Css.CssScanner.GetUnicode()
NUglify.Css.CssScanner.GetEscape()
NUglify.Css.CssScanner.GetString()
NUglify.Css.CssScanner.ScanUrl()
NUglify.Css.CssScanner.NextToken(bool reduceZeros)
NUglify.Css.CssParser.NextToken()
NUglify.Css.CssParser.SkipSpace()
NUglify.Css.CssParser.ParseDeclaration()
NUglify.Css.CssParser.ParseDeclarationList(bool allowMargins)
NUglify.Css.CssParser.ParseDeclarationBlock(bool allowMargins)
NUglify.Css.CssParser.ParseRule()
NUglify.Css.CssParser.ParseStylesheet()
NUglify.Css.CssParser.Parse(string source)
NUglify.Uglify.Css(string source, string fileName, CssSettings settings, CodeSettings scriptSettings)
WebOptimizer.CssMinifier.ExecuteAsync(IAssetContext config)
WebOptimizer.Asset.ExecuteAsync(HttpContext context, IWebOptimizerOptions options)
WebOptimizer.AssetBuilder.BuildAsync(IAsset asset, HttpContext context, IWebOptimizerOptions options)
WebOptimizer.AssetMiddleware.HandleAssetAsync(HttpContext context, IAsset asset, WebOptimizerOptions options)
Microsoft.AspNetCore.ResponseCompression.ResponseCompressionMiddleware.InvokeCore(HttpContext context)
Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task)
Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.HandleException(HttpContext context, ExceptionDispatchInfo edi)
Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
2 years ago
What language ( like US or else) do you select during install?
1 year ago
I am having the same issue. I have recently installed the framework and i am receiving the same exception. It is comming from a module called NUglify
1 year ago
See if this helps
https://www.nopcommerce.com/en/boards/topic/49492/could-not-load-file-or-assembly-nuglify

(bottom line, "Unblock" your nopCommerce archive downloaded file before you extract it.)
1 year ago
I ran the script named streams with arguments  -d -s but the problem persist. I am still having the same exception
1 year ago
After some research I found a fix to the problem. At least is valid for development.
Go to the namespace Nop.Web.Framework.WebOptimizer.Processors look for the method ExecuteAsync(IAssetContext context) and comment the code related to Uglify. The method should look lihe this


public override async Task ExecuteAsync(IAssetContext context)
        {
            var content = new Dictionary<string, byte[]>();

            foreach (var key in context.Content.Keys)
            {
                if (key.EndsWith(".min"))
                {
                    content[key] = context.Content[key];
                    continue;
                }

                var input = context.Content[key].AsString();
                //var result = Uglify.Css(input, new CssSettings());

                //var minified = result.Code;

                //if (result.HasErrors)
                //{
                //    await EngineContext.Current.Resolve<ILogger>()
                //        .WarningAsync($"Stylesheet minification: {key}", new(string.Join(Environment.NewLine, result.Errors)));
                //}

                content[key] = input.AsByteArray();
            }

            context.Content = content;

            return;
        }


That is until now the only fix possible for me
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.