Sitelet https://github.com/microsoft/ApplicationInsights-aspnetcore/issues/919
Skip to content
This repository was archived by the owner on Jun 10, 2020. It is now read-only.
This repository was archived by the owner on Jun 10, 2020. It is now read-only.

Deprecate extension methods on WebHostBuilder #919

Description

Proposing to deprecate UseApplicationInsights() extension methods on IWebHostBuilder, https://github.com/microsoft/ApplicationInsights-aspnetcore/blob/develop/src/Microsoft.ApplicationInsights.AspNetCore/Extensions/ApplicationInsightsWebHostBuilderExtensions.cs#L18

The alternate option is to use the AddApplicationInsightsTelemetry() extensions methods on IServiceCollection.
https://github.com/microsoft/ApplicationInsights-aspnetcore/blob/develop/src/Microsoft.ApplicationInsights.AspNetCore/Extensions/ApplicationInsightsExtensions.cs#L65

Reasons:
Former did not allow overrides to customize behavior, so all public docs were already recommending the latter approach.
Visual Studio AI Tools used the Former approach, and this has created customer confusion about which one to use.
With Asp.Net Core 3.0, default templates use IHostBuilder, as opposed to IWebHostBuilder - this already means customers have to use extension methods on IServiceCollection. As of preview 7, the Visual Studio integrated enablement is broken due to this reason. Users should follow non-VS doc to workaround(https://docs.microsoft.com/en-us/azure/azure-monitor/app/asp-net-core#enable-application-insights-server-side-telemetry-no-visual-studio)

If there are no concerns, will ask VS Team to modify "Add Application Insights" experience to use extension methods on IServiceCollection.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions