Skip to content

Clamp Microsoft.ApplicationInsights to < 3.0.0 to prevent runtime crash#390

Merged
xiaomi7732 merged 1 commit into
microsoft:developfrom
xiaomi7732:dev/saars/clamp-ai-sdk-2x
Apr 6, 2026
Merged

Clamp Microsoft.ApplicationInsights to < 3.0.0 to prevent runtime crash#390
xiaomi7732 merged 1 commit into
microsoft:developfrom
xiaomi7732:dev/saars/clamp-ai-sdk-2x

Conversation

@xiaomi7732
Copy link
Copy Markdown
Member

@xiaomi7732 xiaomi7732 commented Apr 3, 2026

Problem

Using Microsoft.ApplicationInsights.AspNetCore v3.0.0 alongside Microsoft.ApplicationInsights.Kubernetes v8.0.0 causes a runtime TypeLoadException:

System.TypeLoadException: Could not load type 'Microsoft.ApplicationInsights.Extensibility.ITelemetryInitializer'
from assembly 'Microsoft.ApplicationInsights, Version=3.0.0.1, ...'

This happens because ITelemetryInitializer was removed in Application Insights SDK 3.0.0.

Fix

Added upper version bound [2.23.0, 3.0.0) on Microsoft.ApplicationInsights and Microsoft.ApplicationInsights.AspNetCore in src/Directory.Packages.props. Users who try to combine this library with AppInsights SDK 3.0.0 will now get a clear NuGet restore error instead of a cryptic runtime crash.

Changes

  • src/Directory.Packages.props — Version ranges updated from 2.23.0 to [2.23.0, 3.0.0)

Verification

  • Build succeeded ✅
  • 80/80 unit tests passed ✅

Fixes #389

Add upper version bound [2.23.0, 3.0.0) on Microsoft.ApplicationInsights and
Microsoft.ApplicationInsights.AspNetCore packages to prevent TypeLoadException
when users combine this library with Application Insights SDK 3.0.0, which
removed ITelemetryInitializer.

Fixes microsoft#389

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@xiaomi7732 xiaomi7732 merged commit 443b2ff into microsoft:develop Apr 6, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No Longer Compatible to Application Insights Version 3.0.0

3 participants