IvanJosipovic / BlazorApplicationInsights

Application Insights for Blazor web applications

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Confusion about how to configure the application in a Blazor WASM Standalone application

stephajn opened this issue · comments

Your documentation seems a little self-contradicting when it comes to setting up the configuration for Application Insights in a Blazor WASM Standalone application.

In the JavaScript snippet, you reference having an instrumentationKey property that is all zeroes, but then for the line in Program.cs where we call on AddApplicationInsights, your code sample shows setting the ConnectionString property instead. My understanding is that Microsoft is aiming to have people move away from using connection strings and to use instrumentation keys instead. I may be wrong on that.

It appears though, that your library allows for either approach. Is this right?

Also, are there any assembly trimming considerations to worry about with this library? Because when the application would start up, I would get an exception saying that the BlazorApplicationInsights.Models.Config class couldn't be resolved. The application itself compiled just fine, but at runtime, it looked like that class couldn't be found.

Thanks for any pointers you can provide.

Hey,

On #1, that is correct, I recommend setting the InsturmentationKey to all 0s as App Insights JS complains without it. Its there as a placeholder to prevent JS warnings. The value is updated during the Blazor startup process. This library allows using either ConnectionString or InstrumentationKey.

On #2, can you please create a separate issue. The library might need some tweaks to allow Trimming.