Skip to content

fix: pin App Insights WorkerService to 2.x (isolated-worker startup crash)#6

Merged
cao825 merged 1 commit into
mainfrom
fix/appinsights-startup-crash
Jun 21, 2026
Merged

fix: pin App Insights WorkerService to 2.x (isolated-worker startup crash)#6
cao825 merged 1 commit into
mainfrom
fix/appinsights-startup-crash

Conversation

@cao825

@cao825 cao825 commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes a startup crash discovered during the first deploy of the Function App. The isolated worker exited with code 134 on boot:

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

No functions loaded; the deployed API returned 502 / no response on every route.

Root cause

Microsoft.ApplicationInsights.WorkerService 3.1.2 pulls in Microsoft.ApplicationInsights 3.x, whose type layout is incompatible with Microsoft.Azure.Functions.Worker.ApplicationInsights (2.51.0), which expects ITelemetryInitializer from the 2.x assembly. The mismatch throws TypeLoadException and crashes the host.

Fix

Pin Microsoft.ApplicationInsights.WorkerService to 2.22.0, which resolves Microsoft.ApplicationInsights back to the 2.x line (2.23.0) — the version pairing the Functions worker App Insights integration. No application logic changed; one PackageReference version + an explanatory comment.

Validation

  • dotnet build -c Release -warnaserror0 warnings / 0 errors
  • dotnet list package --include-transitiveMicrosoft.ApplicationInsights 2.23.0 (was 3.1.2)

After merge, the app is redeployed and verified end-to-end (GET /api/checks, GET /api/sla).

🤖 Generated with Claude Code

…artup crash

The deployed Function App crashed on startup (dotnet exit 134) with:
  System.TypeLoadException: Could not load type
  'Microsoft.ApplicationInsights.Extensibility.ITelemetryInitializer' from assembly
  'Microsoft.ApplicationInsights, Version=3.1.2...'
so no functions loaded and the API returned 502 / no response.

Microsoft.ApplicationInsights.WorkerService 3.1.2 pulls Microsoft.ApplicationInsights 3.x,
whose type layout is incompatible with Microsoft.Azure.Functions.Worker.ApplicationInsights
(2.x). Pinning WorkerService to 2.22.0 resolves Microsoft.ApplicationInsights back to the
2.x line (2.23.0), matching the Functions worker AI integration.

Build stays 0 warnings / 0 errors with -warnaserror.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@cao825 cao825 merged commit 76ff6db into main Jun 21, 2026
10 checks passed
@cao825 cao825 deleted the fix/appinsights-startup-crash branch June 21, 2026 12:13
claude Bot pushed a commit that referenced this pull request Jun 22, 2026
…(prod recovery) (#23)

INCIDENT 2026-06-22: Dependabot PR #22 bumped Microsoft.ApplicationInsights.WorkerService
2.22.0 -> 3.1.2 (reverting PR #6's pin); auto-merge + CD shipped it and the isolated worker
crash-looped on startup (TypeLoadException: ITelemetryInitializer; host served 502). WorkerService
3.x pulls Microsoft.ApplicationInsights 3.x, incompatible with Worker.ApplicationInsights 2.x.

Recovery:
- Re-pin WorkerService to 2.22.0 (exact pin; resolves Microsoft.ApplicationInsights back to 2.23.0,
  the proven-good state). Build -c Release -warnaserror 0/0.

Prevent recurrence (the comment alone wasn't a guard — Dependabot overrode it):
- .github/dependabot.yml: ignore semver-major updates for Microsoft.ApplicationInsights.WorkerService
  AND Microsoft.ApplicationInsights. This ignore rule is the real enforcement.
- Strengthened the csproj comment to reference PR #6, PR #22, this outage, and the ignore rule.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

1 participant