Azure Application Insights Telemetry not capturing user context in Blazor WebAssembly app
I've searched everywhere and can't find a clear answer. I keep running into I'm sure I'm missing something obvious here, but I'm working on a Blazor WebAssembly application and recently integrated Azure Application Insights to gather telemetry data. However, I'm facing an issue where the user context is not being captured correctly in my telemetry events. I followed the setup guide and included the necessary packages, but it seems that the custom user properties I'm trying to track are not appearing in the telemetry data. Here's a snippet of my `Program.cs` where I configure Application Insights: ```csharp using Microsoft.ApplicationInsights; using Microsoft.ApplicationInsights.Extensibility; using Microsoft.Extensions.DependencyInjection; var builder = WebAssemblyHostBuilder.CreateDefault(args); // Add Application Insights services builder.Services.AddSingleton<ITelemetryInitializer, MyCustomTelemetryInitializer>(); builder.Services.AddApplicationInsightsTelemetry(options => { options.InstrumentationKey = "YOUR_INSTRUMENTATION_KEY"; }); var host = builder.Build(); await host.RunAsync(); ``` I also implemented a custom telemetry initializer to attach user-related information: ```csharp public class MyCustomTelemetryInitializer : ITelemetryInitializer { public void Initialize(ITelemetry telemetry) { // Assume GetUserId() returns the current user's ID telemetry.Context.User.Id = GetUserId(); telemetry.Context.User.AuthenticatedUserId = GetUserAuthId(); } } ``` Despite this, when I inspect the telemetry in Azure, the `User.Id` remains empty. I confirmed that `GetUserId()` and `GetUserAuthId()` are returning valid values. I've also checked the network requests in the browser's developer tools, and I can see the telemetry data being sent, but the user context fields are simply missing. Is there a specific step or configuration I might have overlooked? I'm using the Microsoft.ApplicationInsights.AspNetCore version 2.5.0. Any guidance on how to ensure the user context is captured properly would be greatly appreciated. For context: I'm using C# on Windows. Am I missing something obvious? My development environment is Linux. This issue appeared after updating to C# latest. What would be the recommended way to handle this?