Closed toolgood closed 1 year ago
We are facing the same problem.
Hello!
Thanks for information! Try updating to version 2.13.3.
Hi @Taritsyn thx for your efforts and support.
I've updated to latest version and the error changed. Now we are getting some blank screens. I've no clue which info to send you. Some Views work fine and others don't.
I see some changes in code to prevent the _compressionStream
from null at BodyWrapperStreamBase, This was the problematic line.
This problem started when we upgraded from net6.0 to net7.0.
But there is an workaround:
Our code
builder.Services
.AddWebMarkupMin(options =>
{
options.AllowMinificationInDevelopmentEnvironment = true;
options.AllowCompressionInDevelopmentEnvironment = true;
})
.AddHtmlMinification()
.AddXmlMinification()
.AddHttpCompression(options => { options.ExcludedPages = new List<IUrlMatcher> { new WildcardUrlMatcher("/health*") }; });
If I change to this:
builder.Services
.AddWebMarkupMin(options =>
{
options.AllowMinificationInDevelopmentEnvironment = true;
options.AllowCompressionInDevelopmentEnvironment = true;
})
.AddHtmlMinification(options =>
{
HtmlMinificationSettings settings = options.MinificationSettings;
settings.RemoveRedundantAttributes = true;
settings.RemoveHttpProtocolFromAttributes = true;
settings.RemoveHttpsProtocolFromAttributes = true;
options.CssMinifierFactory = new NUglifyCssMinifierFactory();
options.JsMinifierFactory = new NUglifyJsMinifierFactory();
})
.AddXmlMinification()
.AddHttpCompression(options => { options.ExcludedPages = new List<IUrlMatcher> { new WildcardUrlMatcher("/health*") }; });
It start to work again.
Hello, Bruno!
Today I fixed another small defect and released version 2.13.4.
… Now we are getting some blank screens. … … This problem started when we upgraded from net6.0 to net7.0.
Prior to version 2.13.0, as a rule, such errors occurred for 2 reasons: due to outdated implementation of the BodyWrapperStreamBase
class and peculiarities of disposing an empty instance of the BrotliStream
class. Now, in most cases, such errors no longer occur (“[WebMarkupMin.AspNetCore5] Sometimes a blank page is returned as the request has no response data available” and “Blank page response”). It is quite possible that you are using an extension focused on old version of ASP.NET Core and you should replace it by the WebMarkupMin.AspNetCore7 package.
… Some Views work fine and others don't.
It is possible that some Views contain HTML code with syntax errors. Therefore, I recommend you to write your own logger or use the built-in logger (ThrowExceptionLogger
class). In your case, the logger for WebMarkupMin needs to be registered in the Program.cs
file as follows:
…
using IWmmLogger = WebMarkupMin.Core.Loggers.ILogger;
using WmmThrowExceptionLogger = WebMarkupMin.Core.Loggers.ThrowExceptionLogger;
…
var builder = WebApplication.CreateBuilder(args);
…
// Override the default logger for WebMarkupMin.
builder.Services.AddSingleton<IWmmLogger, WmmThrowExceptionLogger>();
…
error message
WebMarkupMin code
WebMarkupMin. AspNetCore6 and WebMarkupMin AspNetCore7 is the same error