jsakamoto / Toolbelt.Blazor.HeadElement

Head element support (change the document title, "meta" elements such as OGP, and "link" elements) for Blazor apps.
https://demo-blazor-headelement.azurewebsites.net/
Mozilla Public License 2.0
158 stars 11 forks source link

Could not find 'Toolbelt.Head.Title.query' ('Toolbelt' was undefined). #20

Open Alerinos opened 2 years ago

Alerinos commented 2 years ago

I have this problem, I'm using Core 6 preview Blazor server

[13:37:22 WRN] Unhandled exception rendering component: Could not find 'Toolbelt.Head.Title.query' ('Toolbelt' was undefined).
Error: Could not find 'Toolbelt.Head.Title.query' ('Toolbelt' was undefined).
    at https://localhost:5001/_framework/blazor.server.js:1:288
    at Array.forEach (<anonymous>)
    at r.findFunction (https://localhost:5001/_framework/blazor.server.js:1:256)
    at v (https://localhost:5001/_framework/blazor.server.js:1:1882)
    at https://localhost:5001/_framework/blazor.server.js:1:2662
    at new Promise (<anonymous>)
    at et.beginInvokeJSFromDotNet (https://localhost:5001/_framework/blazor.server.js:1:2643)
    at https://localhost:5001/_framework/blazor.server.js:1:62750
    at Array.forEach (<anonymous>)
    at et._invokeClientMethod (https://localhost:5001/_framework/blazor.server.js:1:62736)
Microsoft.JSInterop.JSException: Could not find 'Toolbelt.Head.Title.query' ('Toolbelt' was undefined).
Error: Could not find 'Toolbelt.Head.Title.query' ('Toolbelt' was undefined).
    at https://localhost:5001/_framework/blazor.server.js:1:288
    at Array.forEach (<anonymous>)
    at r.findFunction (https://localhost:5001/_framework/blazor.server.js:1:256)
    at v (https://localhost:5001/_framework/blazor.server.js:1:1882)
    at https://localhost:5001/_framework/blazor.server.js:1:2662
    at new Promise (<anonymous>)
    at et.beginInvokeJSFromDotNet (https://localhost:5001/_framework/blazor.server.js:1:2643)
    at https://localhost:5001/_framework/blazor.server.js:1:62750
    at Array.forEach (<anonymous>)
    at et._invokeClientMethod (https://localhost:5001/_framework/blazor.server.js:1:62736)
   at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, Object[] args) in Microsoft.JSInterop.dll:token 0x6000039+0x18b
   at Toolbelt.Blazor.HeadElement.HeadElementHelperService.InvokeJSAsync[T](String identifier, Object[] args) in Toolbelt.Blazor.HeadElement.Services.dll:token 0x6000004+0x0
   at Toolbelt.Blazor.HeadElement.HeadElementHelperService.GetDefaultTitleAsync() in Toolbelt.Blazor.HeadElement.Services.dll:token 0x600000d+0x8f
   at Toolbelt.Blazor.HeadElement.HeadElementHelperService.GetDefaultsAsync() in Toolbelt.Blazor.HeadElement.Services.dll:token 0x6000007+0x77
   at Toolbelt.Blazor.HeadElement.HeadElementHelperService.ResetIfNeededAsync() in Toolbelt.Blazor.HeadElement.Services.dll:token 0x6000006+0xe8
   at Toolbelt.Blazor.HeadElement.HeadElementHelperService.SetTitleAsync(String title) in Toolbelt.Blazor.HeadElement.Services.dll:token 0x6000009+0xdb
   at Toolbelt.Blazor.HeadElement.Title.OnParametersSetAsync() in Toolbelt.Blazor.HeadElement.dll:token 0x6000030+0xf1
   at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task) in Microsoft.AspNetCore.Components.dll:token 0x60000a2+0x65
   at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync() in Microsoft.AspNetCore.Components.dll:token 0x60000a0+0x154
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState) in Microsoft.AspNetCore.Components.dll:token 0x600023e+0xb9
[13:37:22 ERR] Unhandled exception in circuit 'vMPYy120JDyAqnqG6k6T7qo-bQJrEf2pq1dbe2n2sGU'.
Microsoft.JSInterop.JSException: Could not find 'Toolbelt.Head.Title.query' ('Toolbelt' was undefined).
Error: Could not find 'Toolbelt.Head.Title.query' ('Toolbelt' was undefined).
    at https://localhost:5001/_framework/blazor.server.js:1:288
    at Array.forEach (<anonymous>)
    at r.findFunction (https://localhost:5001/_framework/blazor.server.js:1:256)
    at v (https://localhost:5001/_framework/blazor.server.js:1:1882)
    at https://localhost:5001/_framework/blazor.server.js:1:2662
    at new Promise (<anonymous>)
    at et.beginInvokeJSFromDotNet (https://localhost:5001/_framework/blazor.server.js:1:2643)
    at https://localhost:5001/_framework/blazor.server.js:1:62750
    at Array.forEach (<anonymous>)
    at et._invokeClientMethod (https://localhost:5001/_framework/blazor.server.js:1:62736)
   at Microsoft.JSInterop.JSRuntime.InvokeAsync[TValue](Int64 targetInstanceId, String identifier, Object[] args) in Microsoft.JSInterop.dll:token 0x6000039+0x18b
   at Toolbelt.Blazor.HeadElement.HeadElementHelperService.InvokeJSAsync[T](String identifier, Object[] args) in Toolbelt.Blazor.HeadElement.Services.dll:token 0x6000004+0x0
   at Toolbelt.Blazor.HeadElement.HeadElementHelperService.GetDefaultTitleAsync() in Toolbelt.Blazor.HeadElement.Services.dll:token 0x600000d+0x8f
   at Toolbelt.Blazor.HeadElement.HeadElementHelperService.GetDefaultsAsync() in Toolbelt.Blazor.HeadElement.Services.dll:token 0x6000007+0x77
   at Toolbelt.Blazor.HeadElement.HeadElementHelperService.ResetIfNeededAsync() in Toolbelt.Blazor.HeadElement.Services.dll:token 0x6000006+0xe8
   at Toolbelt.Blazor.HeadElement.HeadElementHelperService.SetTitleAsync(String title) in Toolbelt.Blazor.HeadElement.Services.dll:token 0x6000009+0xdb
   at Toolbelt.Blazor.HeadElement.Title.OnParametersSetAsync() in Toolbelt.Blazor.HeadElement.dll:token 0x6000030+0xf1
   at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion(Task task) in Microsoft.AspNetCore.Components.dll:token 0x60000a2+0x65
   at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync() in Microsoft.AspNetCore.Components.dll:token 0x60000a0+0x154
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task taskToHandle, ComponentState owningComponentState) in Microsoft.AspNetCore.Components.dll:token 0x600023e+0xb9
[13:37:22 INF] Executed endpoint '/_blazor'
Alerinos commented 2 years ago

i fix it

    <PackageReference Include="Toolbelt.Blazor.HeadElement" Version="6.0.0-preview.3" />
    <PackageReference Include="Toolbelt.Blazor.HeadElement.ServerPrerendering" Version="6.0.0-preview.3" />

I had to add it manually to the project, nuget refused to download this version for me.

The next problem is that I have a blank page, nothing renders. No html tag (empty in source)

Console log:

[14:10:32 INF] Now listening on: https://localhost:5001
[14:10:32 INF] Application started. Press Ctrl+C to shut down.
[14:10:32 INF] Hosting environment: Production
[14:10:32 INF] Content root path: C:\Git\Stand\Stand\bin\Debug\net6.0
[14:10:42 INF] Request starting HTTP/2 GET https://localhost:5001/ - -
[14:10:42 INF] Executing endpoint '/_Host'
[14:10:42 INF] Route matched with {page = "/_Host", area = ""}. Executing page /_Host
[14:10:42 INF] Executing an implicit handler method - ModelState is Valid
[14:10:42 INF] Executed an implicit handler method, returned result Microsoft.AspNetCore.Mvc.RazorPages.PageResult.
[14:10:43 INF] Executed page /_Host in 888.5204ms
[14:10:43 INF] Executed endpoint '/_Host'
[14:10:43 INF] Request finished HTTP/2 GET https://localhost:5001/ - - - 200 - text/html;+charset=utf-8 1058.6362ms
[14:10:45 INF] Request starting HTTP/2 GET https://localhost:5001/ - -
[14:10:45 INF] Executing endpoint '/_Host'
[14:10:45 INF] Route matched with {page = "/_Host", area = ""}. Executing page /_Host
[14:10:45 INF] Executing an implicit handler method - ModelState is Valid
[14:10:45 INF] Executed an implicit handler method, returned result Microsoft.AspNetCore.Mvc.RazorPages.PageResult.
[14:10:46 INF] Executed page /_Host in 796.384ms
[14:10:46 INF] Executed endpoint '/_Host'
[14:10:46 INF] Request finished HTTP/2 GET https://localhost:5001/ - - - 200 - text/html;+charset=utf-8 805.7219ms
[14:10:47 INF] Request starting HTTP/2 GET https://localhost:5001/ - -
[14:10:47 INF] Executing endpoint '/_Host'
[14:10:47 INF] Route matched with {page = "/_Host", area = ""}. Executing page /_Host
[14:10:47 INF] Executing an implicit handler method - ModelState is Valid
[14:10:47 INF] Executed an implicit handler method, returned result Microsoft.AspNetCore.Mvc.RazorPages.PageResult.
[14:10:48 INF] Executed page /_Host in 801.1824ms
[14:10:48 INF] Executed endpoint '/_Host'
[14:10:48 INF] Request finished HTTP/2 GET https://localhost:5001/ - - - 200 - text/html;+charset=utf-8 824.8403ms
[14:10:48 INF] Request starting HTTP/2 GET https://localhost:5001/ - -
[14:10:48 INF] Executing endpoint '/_Host'
[14:10:48 INF] Route matched with {page = "/_Host", area = ""}. Executing page /_Host
[14:10:48 INF] Executing an implicit handler method - ModelState is Valid
[14:10:48 INF] Executed an implicit handler method, returned result Microsoft.AspNetCore.Mvc.RazorPages.PageResult.
[14:10:49 INF] Executed page /_Host in 816.2826ms
[14:10:49 INF] Executed endpoint '/_Host'
[14:10:49 INF] Request finished HTTP/2 GET https://localhost:5001/ - - - 200 - text/html;+charset=utf-8 826.5096ms
            #region Blazor
            services.AddServerSideBlazor();
            #endregion

            services.AddHeadElementHelper();
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            // Proxy
            app.UseForwardedHeaders();

            if (env.IsDevelopment()) {
                app.UseDeveloperExceptionPage();
            } else {
                app.UseExceptionHandler("/Error"); //TODO: Dodaj obsługę błedów
                app.UseHsts();
            }

            app.UseHeadElementServerPrerendering();

            app.UseResponseCompression();   // Compression
            app.UseImageSharp();            // Add the image processing middleware.
            app.UseHttpsRedirection();      // wwwroot
            app.UseStaticFiles();

            var dir = Path.Combine(Directory.GetCurrentDirectory(), "Public");
            var compositeProvider = new CompositeFileProvider(env.WebRootFileProvider, new PhysicalFileProvider(dir));
            env.WebRootFileProvider = compositeProvider;
            app.UseStaticFiles(new StaticFileOptions {
                OnPrepareResponse = ctx => {
                    ctx.Context.Response.Headers.Append(
                        "Cache-Control", $"public, max-age={_configuration["Server:Website:Cache:MaxAge"]}");
                }
            });

            app.UseRouting();

            // Plugin
            app.UseMiddleware<Utilities.Help.Notification>();

            // Language
            //app.UseRewriter(new RewriteOptions().Add(new FirstLoadRewriteRule()));
            app.UseRequestLocalization();

            // app.UseAuthorization(); // Disabled

            app.UseEndpoints(endpoints => {

                //endpoints.MapRazorPages();
                endpoints.MapBlazorHub();
                endpoints.MapFallbackToPage("/_Host");

            });

            #region CodePages
            app.UseStatusCodePages(context => {
                var request = context.HttpContext.Request;
                var response = context.HttpContext.Response;

                if (response.StatusCode == StatusCodes.Status404NotFound)
                    response.Redirect("/Error/404");

                return Task.CompletedTask;
            });
            #endregion
        }
jsakamoto commented 2 years ago

@Alerinos Thanks for reporting.

I tried to reproduce your problem on my hand, but unfortunately, I couldn't.

So to isolate the cause of the problem, could you try to comment out "app.UseHeadElementServerPrerendering()" and rerun it, and let me know if you still get an empty response?

Or, I welcome you to zip & attach the whole project that can reproduce the problem to this thread.

Alerinos commented 2 years ago

At the moment of commenting, the page works, the content is rendered, but the title is not changed. The title is hidden in the source of the page. At the time of uncommenting, the site also works until I put </p> <p>My project is like a library, blazor server page is running by another project. It is also a migration from Razor Pages. Will try to create a new project and see if it works.</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/Alerinos"><img src="https://avatars.githubusercontent.com/u/42449535?v=4" />Alerinos</a> commented <strong> 2 years ago</strong> </div> <div class="markdown-body"> <p>Found a bug, add this:</p> <pre><code> #region Compression services.Configure<BrotliCompressionProviderOptions>(o => { o.Level = CompressionLevel.Optimal; }); services.Configure<GzipCompressionProviderOptions>(o => { o.Level = CompressionLevel.Optimal; }); services.AddResponseCompression(options => { options.EnableForHttps = true; options.MimeTypes = ResponseCompressionDefaults.MimeTypes.Concat(new[] { "application/javascript", "application/json", "application/xml", "application/xhtml+xml", "text/css", "text/json", "text/plain", "text/html", "text/plain", "text/xml", "image/jpeg", "image/png", "image/webp", "application/font-woff2", "image/svg+xml", "image/x-icon", "image/svg+xml", "font/woff2", }); options.Providers.Add<BrotliCompressionProvider>(); options.Providers.Add<GzipCompressionProvider>(); }); #endregion</code></pre> <pre><code> app.UseResponseCompression(); // Compression</code></pre> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/Alerinos"><img src="https://avatars.githubusercontent.com/u/42449535?v=4" />Alerinos</a> commented <strong> 2 years ago</strong> </div> <div class="markdown-body"> <p><a href="https://github.com/jsakamoto/Toolbelt.Blazor.HeadElement/files/6987006/BlazorToolbeltTest.zip">BlazorToolbeltTest.zip</a> There is one more error here, when you don't compress the title doesn't change dynamically. The server renders well blazor no.</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/jsakamoto"><img src="https://avatars.githubusercontent.com/u/95908?v=4" />jsakamoto</a> commented <strong> 2 years ago</strong> </div> <div class="markdown-body"> <p>@Alerinos Thanks for your cooperation. 👍 </p> <p>I could reproduce the problem, and I could find the reason for the problem.</p> <p>Currently your code is like this:</p> <pre><code class="language-csharp">app.UseHeadElementServerPrerendering(); app.UseResponseCompression(); app.UseHttpsRedirection(); app.UseStaticFiles();</code></pre> <p>Could you try to change the code above to below?</p> <pre><code class="language-csharp">app.UseResponseCompression(); app.UseHttpsRedirection(); app.UseHeadElementServerPrerendering(); // 👈 Place this just before `UseStaticFile()` app.UseStaticFiles();</code></pre> <p>The <code>UseHeadElementServerPrerendering()</code> feature rewrites the HTML text response to change a title, meta, and link elements.</p> <p>But if the <code>UseResponseCompression()</code> is placed after the <code>UseHeadElementServerPrerendering()</code>, then the <code>UseHeadElementServerPrerendering()</code> will receive <strong>an after compressed contents</strong>. So the <code>UseHeadElementServerPrerendering()</code> could not rewrite it.</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/Alerinos"><img src="https://avatars.githubusercontent.com/u/42449535?v=4" />Alerinos</a> commented <strong> 2 years ago</strong> </div> <div class="markdown-body"> <p>I did, and it only works for server rendering. Blazor has a rendering problem. The problem seems to me to be running it from another project. (See zip package above). We have a "www" project + a "start" project</p> <p>Another problem I see is when we do this:</p> <pre><code><Title>Counter(2) - Server Side App</Title> <Meta Name="description" Content="" /> <Link href="css/site2.css" rel="stylesheet" /></code></pre> <p>The server takes a long time to render the content. The more tags, the longer the server response. Maybe a loop?</p> <p>Use this and test the times. Something is wrong, the server renders for a long time.</p> <pre><code><Title>Counter(2) - Server Side App</Title> <Meta Name="description" Content="" /> <Link href="css/site2.css" rel="stylesheet" /> <Link href="css/site3.css" rel="stylesheet" /> <Link href="css/site4.css" rel="stylesheet" /> <Link href="css/site5.css" rel="stylesheet" /> <Link href="css/site6.css" rel="stylesheet" /> <Link href="css/site7.css" rel="stylesheet" /> <Link href="css/site8.css" rel="stylesheet" /> <Link href="css/site9.css" rel="stylesheet" /> <Link href="css/site10.css" rel="stylesheet" /> <Link href="css/site11.css" rel="stylesheet" /> <Link href="css/site12.css" rel="stylesheet" /></code></pre> <p>16:01:52-16:02:09 It took 17 seconds to render the page.</p> <pre><code>[16:01:52 INF] Executed an implicit handler method, returned result Microsoft.AspNetCore.Mvc.RazorPages.PageResult. [16:02:09 INF] Executed page /_Host in 16626.7141ms [16:02:09 INF] Executed endpoint '/_Host' [16:02:09 INF] Request finished HTTP/2 GET https://localhost:5001/ - - - 200 - text/html;+charset=utf-8 16734.3472ms [16:02:09 INF] Request starting HTTP/2 POST https://localhost:5001/_blazor/disconnect multipart/form-data;+boundary=----WebKitFormBoundaryB8BBCH8t1sUXhG0V 359 [16:02:09 INF] Executing endpoint 'Blazor disconnect' [16:02:09 INF] Executed endpoint '/_blazor' [16:02:09 INF] Request finished HTTP/1.1 GET https://localhost:5001/_blazor?id=zNhs4vFSdCjci8jRltBkdg - - - 101 - - 494419.4210ms [16:02:09 INF] Executed endpoint 'Blazor disconnect' [16:02:09 INF] Request finished HTTP/2 POST https://localhost:5001/_blazor/disconnect multipart/form-data;+boundary=----WebKitFormBoundaryB8BBCH8t1sUXhG0V 359 - 200 0 - 4.8332ms [16:02:09 INF] Request starting HTTP/2 GET https://localhost:5001/lib/bootstrap/5.0.1/css/bootstrap.min.css?v=hHKA3d_HttC8OW3Sl093W8DoZudhHJDj--kZYo6MLzA - - [16:02:09 INF] Request starting HTTP/2 GET https://localhost:5001/lib/font-awesome/5.15.3/css/all.min.css?v=2H3fkXt6FEmrReK448mDVGKb3WW2ZZw35gI7vqHOE4Y - - [16:02:09 INF] Request starting HTTP/2 GET https://localhost:5001/css/site.css - - [16:02:09 INF] The file /lib/bootstrap/5.0.1/css/bootstrap.min.css was not modified [16:02:09 INF] The file /lib/font-awesome/5.15.3/css/all.min.css was not modified [16:02:09 INF] The file /css/site.css was not modified [16:02:09 INF] Request finished HTTP/2 GET https://localhost:5001/lib/bootstrap/5.0.1/css/bootstrap.min.css?v=hHKA3d_HttC8OW3Sl093W8DoZudhHJDj--kZYo6MLzA - - - 304 - text/css 4.2597ms [16:02:09 INF] Request finished HTTP/2 GET https://localhost:5001/lib/font-awesome/5.15.3/css/all.min.css?v=2H3fkXt6FEmrReK448mDVGKb3WW2ZZw35gI7vqHOE4Y - - - 304 - text/css 6.4942ms [16:02:09 INF] Request finished HTTP/2 GET https://localhost:5001/css/site.css - - - 304 - text/css 7.2785ms [16:02:09 INF] Request starting HTTP/2 GET https://localhost:5001/_framework/blazor.server.js - - [16:02:09 INF] The file /_framework/blazor.server.js was not modified [16:02:09 INF] Request finished HTTP/2 GET https://localhost:5001/_framework/blazor.server.js - - - 304 - application/javascript 2.8204ms [16:02:09 INF] Request starting HTTP/2 GET https://localhost:5001/css/open-iconic/font/css/open-iconic-bootstrap.min.css - - [16:02:09 INF] Request finished HTTP/2 GET https://localhost:5001/css/open-iconic/font/css/open-iconic-bootstrap.min.css - - - 302 0 - 1.1444ms [16:02:09 INF] Request starting HTTP/2 GET https://localhost:5001/Error/404 - - [16:02:09 INF] Executing endpoint '/Error' [16:02:09 INF] Route matched with {page = "/Error", area = ""}. Executing page /Error [16:02:09 INF] Executing handler method Website.Pages.ErrorModel.OnGet - ModelState is Valid [16:02:09 INF] Executed handler method OnGet, returned result . [16:02:09 INF] Executing an implicit handler method - ModelState is Valid [16:02:09 INF] Executed an implicit handler method, returned result Microsoft.AspNetCore.Mvc.RazorPages.PageResult. [16:02:09 INF] Executed page /Error in 4.1749ms [16:02:09 INF] Executed endpoint '/Error' [16:02:09 INF] Request finished HTTP/2 GET https://localhost:5001/Error/404 - - - 200 - text/html;+charset=utf-8 9.6651ms [16:02:09 INF] Request starting HTTP/2 GET https://localhost:5001/template/image/header.webp - - [16:02:09 INF] Request starting HTTP/2 GET https://localhost:5001/lib/font-awesome/5.15.3/webfonts/fa-solid-900.woff2 - - [16:02:09 INF] Request starting HTTP/2 GET https://localhost:5001/template/image/background.webp - - [16:02:09 INF] Request starting HTTP/2 GET https://localhost:5001/lib/font-awesome/5.15.3/webfonts/fa-brands-400.woff2 - - [16:02:09 INF] The file /template/image/header.webp was not modified [16:02:09 INF] The file /lib/font-awesome/5.15.3/webfonts/fa-solid-900.woff2 was not modified [16:02:09 INF] Request starting HTTP/2 GET https://localhost:5001/template/image/logo_white.svg - - [16:02:09 INF] The file /lib/font-awesome/5.15.3/webfonts/fa-brands-400.woff2 was not modified [16:02:09 INF] Request finished HTTP/2 GET https://localhost:5001/template/image/header.webp - - - 304 - image/webp 4.6688ms [16:02:09 INF] The file /template/image/background.webp was not modified [16:02:09 INF] Request starting HTTP/2 POST https://localhost:5001/_blazor/negotiate?negotiateVersion=1 text/plain;charset=UTF-8 0 [16:02:09 INF] Request finished HTTP/2 GET https://localhost:5001/lib/font-awesome/5.15.3/webfonts/fa-solid-900.woff2 - - - 304 - font/woff2 8.0968ms [16:02:09 INF] The file /template/image/logo_white.svg was not modified [16:02:09 INF] Request finished HTTP/2 GET https://localhost:5001/lib/font-awesome/5.15.3/webfonts/fa-brands-400.woff2 - - - 304 - font/woff2 10.0705ms [16:02:09 INF] Request finished HTTP/2 GET https://localhost:5001/template/image/background.webp - - - 304 - image/webp 13.2684ms [16:02:09 INF] Executing endpoint '/_blazor/negotiate' [16:02:09 INF] Request finished HTTP/2 GET https://localhost:5001/template/image/logo_white.svg - - - 304 - image/svg+xml 9.7513ms [16:02:09 INF] Executed endpoint '/_blazor/negotiate' [16:02:09 INF] Request finished HTTP/2 POST https://localhost:5001/_blazor/negotiate?negotiateVersion=1 text/plain;charset=UTF-8 0 - 200 - application/json 18.5151ms [16:02:09 INF] Request starting HTTP/1.1 GET https://localhost:5001/_blazor?id=Qbt3Cl2ZfV9ORlBGQcxi3w - - [16:02:09 INF] Executing endpoint '/_blazor' [16:02:09 INF] Request starting HTTP/2 GET https://localhost:5001/_content/Toolbelt.Blazor.HeadElement.Services/script.module.min.js?v=6.0.0-preview.3 - - [16:02:09 INF] Request finished HTTP/2 GET https://localhost:5001/_content/Toolbelt.Blazor.HeadElement.Services/script.module.min.js?v=6.0.0-preview.3 - - - 302 0 - 1.1099ms [16:02:09 INF] Request starting HTTP/2 GET https://localhost:5001/Error/404 - - [16:02:09 INF] Executing endpoint '/Error' [16:02:09 INF] Request starting HTTP/2 GET https://localhost:5001/template/image/logo_white.svg - - [16:02:09 INF] Route matched with {page = "/Error", area = ""}. Executing page /Error [16:02:09 INF] The file /template/image/logo_white.svg was not modified [16:02:09 INF] Executing handler method Website.Pages.ErrorModel.OnGet - ModelState is Valid [16:02:09 INF] Request finished HTTP/2 GET https://localhost:5001/template/image/logo_white.svg - - - 304 - image/svg+xml 3.5160ms [16:02:09 INF] Executed handler method OnGet, returned result . [16:02:09 INF] Executing an implicit handler method - ModelState is Valid [16:02:09 INF] Executed an implicit handler method, returned result Microsoft.AspNetCore.Mvc.RazorPages.PageResult. [16:02:09 INF] Executed page /Error in 10.1768ms [16:02:09 INF] Executed endpoint '/Error' [16:02:09 INF] Request finished HTTP/2 GET https://localhost:5001/Error/404 - - - 200 - text/html;+charset=utf-8 17.0600ms</code></pre> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/jsakamoto"><img src="https://avatars.githubusercontent.com/u/95908?v=4" />jsakamoto</a> commented <strong> 2 years ago</strong> </div> <div class="markdown-body"> <p>@Alerinos </p> <p>I could not reproduce the "the server takes a long time to render the content" problem on the <a href="https://github.com/jsakamoto/Toolbelt.Blazor.HeadElement/files/6987006/BlazorToolbeltTest.zip">BlazorToolbelt.zip</a>.</p> <p><img src="https://user-images.githubusercontent.com/95908/129495660-89882a47-343e-4d6a-b7be-2fb2efec623d.png" alt="image" /></p> <pre><code>info: Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker[104] Executed an implicit handler method, returned result Microsoft.AspNetCore.Mvc.RazorPages.PageResult. info: Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker[4] Executed page /_Host in 129.215ms info: Microsoft.AspNetCore.Routing.EndpointMiddleware[1] Executed endpoint '/_Host' info: Microsoft.AspNetCore.Hosting.Diagnostics[2] Request finished HTTP/2 GET https://localhost:5001/ - - - 200 - text/html;+charset=utf-8 397.0514ms</code></pre> <p>I have no idea at this time that this problem is caused by "HeadElement" or not.</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/Alerinos"><img src="https://avatars.githubusercontent.com/u/42449535?v=4" />Alerinos</a> commented <strong> 2 years ago</strong> </div> <div class="markdown-body"> <p><img src="https://user-images.githubusercontent.com/42449535/129496488-1fca711f-d94b-4d15-94ab-dabdbacd54cd.png" alt="image" /></p> <p>I just did a test on "BlazorToolbelt.zip", I have no idea why I'm having such a long time. I am using Microsoft Edg. On Google Chrome it is 5.4 seconds. I also use Visual Studio 2022 windows 11. My CPU is ryzen 9 3900xt and the NVME disk so it shouldn't be a problem.</p> <p>I just did a debug to release test, the time dropped from 8 seconds to 4 but that may be the case.</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/Alerinos"><img src="https://avatars.githubusercontent.com/u/42449535?v=4" />Alerinos</a> commented <strong> 2 years ago</strong> </div> <div class="markdown-body"> <p>Hi, did you find the problem? You need help? I can help, there are generally two mistakes. The first one is the loading time increases, the second one does not work dynamically changing the text when we start a project from another project.</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/jsakamoto"><img src="https://avatars.githubusercontent.com/u/95908?v=4" />jsakamoto</a> commented <strong> 2 years ago</strong> </div> <div class="markdown-body"> <p>@Alerinos </p> <p>Sorry too late.</p> <blockquote> <p>The first one is the loading time increases, </p> </blockquote> <p>I still can't reproduce this problem.<br /> Could you build and run the project I attached to this post below and try to reproduce that problem in your environment?</p> <p><a href="https://github.com/jsakamoto/Toolbelt.Blazor.HeadElement/files/7071984/BlazorToolbeltTest.-.Aug.29.2021.-.J.Sakamoto.zip">📂 BlazorToolbeltTest - Aug 29, 2021 - J.Sakamoto.zip</a></p> <p>If you can't reproduce that problem with the project that I attached, the reason for the problem will not be the "Head Element Helper" library, I think.</p> <blockquote> <p>the second one does not work dynamically changing the text when we start a project from another project.</p> </blockquote> <p>Your fault will cause this problem.</p> <p>You must use the "Sdk=Microsoft.NET.Sdk.<strong>Web</strong>" instead of the "Sdk=Microsoft.NET.Sdk" to create an ASP.NET Core project, especially in the case that the project reference other ASP.NET Core web or component projects.</p> <p>If you don't do that, it will not work fine not only in the "Head Element Helper" library but any NuGet Packages that include JavaScript code.</p> <p>The project that I attached to this post above is modified at this point, and that project works fine. Please see also the comment in the "Start.csproj" file in that project I attached.</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/Alerinos"><img src="https://avatars.githubusercontent.com/u/42449535?v=4" />Alerinos</a> commented <strong> 2 years ago</strong> </div> <div class="markdown-body"> <blockquote> <p>You must use the "Sdk=Microsoft.NET.Sdk.Web" instead of the "Sdk=Microsoft.NET.Sdk" to create an ASP.NET Core project, especially in the case that the project reference other ASP.NET Core web or component projects.</p> </blockquote> <p>Thanks it works, I thought the main project didn't need to have this.</p> <blockquote> <p>I still can't reproduce this problem. Could you build and run the project I attached to this post below and try to reproduce that problem in your environment?</p> </blockquote> <p>Still the same problem, how can i help you? How can I take a memory or program dump?</p> <p><a href="https://github.com/jsakamoto/Toolbelt.Blazor.HeadElement/files/7080045/BlazorToolbeltTest.zip">BlazorToolbeltTest.zip</a> I am sending the whole project (debug, release etc.)</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/Alerinos"><img src="https://avatars.githubusercontent.com/u/42449535?v=4" />Alerinos</a> commented <strong> 2 years ago</strong> </div> <div class="markdown-body"> <blockquote> <p>You must use the "Sdk=Microsoft.NET.Sdk.Web" instead of the "Sdk=Microsoft.NET.Sdk" to create an ASP.NET Core project, especially in the case that the project reference other ASP.NET Core web or component projects.</p> </blockquote> <p>There is another way to do this? Unfortunately my main project runs other projects (SignalR, RestAPI, Bot etc). After switching to Web, the console application does not work for me. :(</p> <p><img src="https://user-images.githubusercontent.com/42449535/131419042-cbebfc45-bd85-468f-9d0a-8f1330a2f5a5.png" alt="image" /></p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/jsakamoto"><img src="https://avatars.githubusercontent.com/u/95908?v=4" />jsakamoto</a> commented <strong> 2 years ago</strong> </div> <div class="markdown-body"> <p>@Alerinos </p> <blockquote> <p>the console application does not work for me. :(</p> </blockquote> <p>Could you explain in more detail what happened? Did an exception happen? If so, what was that exception said?</p> <p>There is nothing that I can do because the hint is only "doesn't work". I don't have mind-reading skills.😅</p> <p>By the way, is your project that includes this problem hosted in any Git repository cloud services like GitHub? If the answer is yes, can I join that repository even if that repository is private? If I can touch the whole of your project on my local PC and run it in debug mode, I can know a lot of information about the problem.</p> <p>Please consider it.</p> </div> </div> <div class="page-bar-simple"> </div> <div class="footer"> <ul class="body"> <li>© <script> document.write(new Date().getFullYear()) </script> Githubissues.</li> <li>Githubissues is a development platform for aggregating issues.</li> </ul> </div> <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js"></script> <script src="/githubissues/assets/js.js"></script> <script src="/githubissues/assets/markdown.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/highlight.min.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/languages/go.min.js"></script> <script> hljs.highlightAll(); </script> </body> </html>