IvanJosipovic / BlazorApplicationInsights

Application Insights for Blazor web applications

Home Page:https://BlazorApplicationInsights.netlify.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No telemetry after upgrading from 2.2.0 with dotnet 7 to 3.0.5 with dotnet 8

KenBrannigan opened this issue · comments

After upgrading from 2.2.0 with dotnet 7 to 3.0.5 with dotnet 8 I no longer see any telemetry going to application insights. Awhile back I added Blazor (WASM) to an existing asp.net core razor page application. I took just one section of the site and converted it to Blazor at which time I added BlazorApplicationInsights to that section. Everything worked perfectly and I could see telemetry like page views being sent to Application Insights.

I recently followed Microsoft's docs to upgrade from dotnet 7 to dotnet 8 and to convert the application to a Blazor Web App. I also followed an article about adding non-routable Blazor components to a razor page. Since that upgrade I no longer get any telemetry.

I still have two applications. The asp.net core host that has the razor pages and a separate client applications that has all the components since I am doing WASM. The host application has a razor page that picks up all routes that start with /Affirmations. This razor page is the entry into the WASM portion of the application. The razor page looks like this:

@page "{*content}"
@using Sample.Web.Blazor

@model Sample.Web.Pages.Blazor.IndexModel

@section Head
{
    <base href="~/" />
}

@section HeadEnd
{
    <component type="typeof(Microsoft.AspNetCore.Components.Web.HeadOutlet)" render-mode="WebAssembly" />
}

<!-- .page-inner -->
<div class="page-inner">
    <component type="typeof(Sample.Web.Blazor.Routes)" render-mode="WebAssembly" />
</div>

@section Scripts
{
    <script src="_framework/blazor.web.js"></script>
}

My Routes component is the one that has BlazorApplicationInsights:

<ApplicationInsightsInit IsWasmStandalone="true" />
<RedirectErrorBoundary>
    <ChildContent>
        <Router AppAssembly="@typeof(Program).Assembly">
            <Found Context="routeData">
                <RouteView RouteData="@routeData" />
            </Found>
            <NotFound>
                <NotFoundRedirect />
            </NotFound>
        </Router>
    </ChildContent>
</RedirectErrorBoundary>

The client project's Program.cs as the call to add BlazorApplicationInsights:

builder.Services
            .AddBlazorApplicationInsights();

My layout page includes and configures the application insights js just like it did before the upgrade and from what I read on your docs this should be fine. I am able to navigate around the pages controlled by blazor like /Affirmations/Add and /Affirmations/Edit and they are all handled by Blazor WASM just like before the upgrade but I don't see the telemetry at all.

Just as an FYI I went back to v2.2.2 and only changed:

<ApplicationInsightsInit IsWasmStandalone="true" />

to

<ApplicationInsightsComponent />

and everything is back to working as expected.

I would need the full reproducible source code to troubleshoot this. Please re-open the issue once you provide it.