Coder Social home page Coder Social logo

Comments (8)

Taritsyn avatar Taritsyn commented on June 11, 2024 1

Hello!

I tried to fix all the above errors in version 2.13.0.

from webmarkupmin.

Sausbolle avatar Sausbolle commented on June 11, 2024 1

Looks like the update fixed the problem. Tested on more complex code that experienced it (and the minimal code) and looks like it works like a charm now.
Thanks for looking into this and the update :)

from webmarkupmin.

Taritsyn avatar Taritsyn commented on June 11, 2024

Hello!

Try disabling a brotli compression.

from webmarkupmin.

ranjit12081982 avatar ranjit12081982 commented on June 11, 2024

NO effect.
I commented package
WebMarkupMin.AspNet.Brotli" Version="2.10.0"
then commented
//new BrotliCompressorFactory(new BrotliCompressionSettings
//{
// Level = 1
//}),

still no change.

from webmarkupmin.

Taritsyn avatar Taritsyn commented on June 11, 2024

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

from webmarkupmin.

Sausbolle avatar Sausbolle commented on June 11, 2024

I think I have similar problem where WebMarkupMin at random times gives empty page response (0 bytes).

This occurs if I have AllowCompressionInDevelopmentEnvironment set to true. So to avoid this bug AllowCompressionInDevelopmentEnvironment needs to be set to false.

It is hard to reproduce since when it occurs it is either every second pageload is empty or it gets into an mode of many empty loads then many good loads. And thus I have not been able to pinpoint to the actual cause and produce a bugtest code.

I've tried to narrow down the code that causes without luck. When I think I have it narrowed down (consistently trigger bug) and try to make bugtest code by removing unrelated pure HTML it suddenly don't occur any more for no apparent reason.
But I suspect bug is related to async ViewComponent or Html.PartialAsync calls, but this is pure speculation.

One additional thing I noticed in logs is that when page loads correctly the Microsoft.AspNetCore.Watch.BrowserRefresh.BrowserRefreshMiddleware failed to load and these two Debug messages are logged (neither is present in log when 0 byes page is served).

DBG - Response markup is scheduled to include browser refresh script injection.
DBG - Unable to configure browser refresh script injection on the response.

I hope some of this info will help you narrow down what the cause might be.

I have not tested in production environment to see if bug is present there too with the code I have yet

from webmarkupmin.

Sausbolle avatar Sausbolle commented on June 11, 2024

Created a minimal code that causes the error
Running ASP .Net 6 (6.0.402)

using Microsoft.AspNetCore.Builder;
using WebMarkupMin.AspNetCore6;
using WebMarkupMin.AspNet.Common.UrlMatchers;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddWebMarkupMin(options =>
{
    options.AllowCompressionInDevelopmentEnvironment = true;
})
    .AddHttpCompression(
        // There is always an option to exclude the routes that returns string and not IActionResult  to make it work
        //options.ExcludedPages = new List<IUrlMatcher> {new ExactUrlMatcher("/") };
    });

var app = builder.Build();

app.UseWebMarkupMin();

// Will become blank if AllowCompressionInDevelopmentEnvironment is true or Production enviroment.
// ...and cause an "Headers are read-only, response has already started." Exception
app.MapGet("/", () => "Will become blank and cause error.");

app.Run();

from webmarkupmin.

Taritsyn avatar Taritsyn commented on June 11, 2024

In this case, it was possible to fix only reproducible errors that lead to the display of a blank page. But, unfortunately, there are also non-reproducible errors.

from webmarkupmin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.