Repository navigation
fix NPE with feature reporter not being available - #3199
Merged
Matthew Sainsbury (Microsoft) (mattsains-msft) merged 3 commits intoJul 30, 2026
Conversation
Copilot started reviewing on behalf of
Matthew Sainsbury (Microsoft) (mattsains-msft)
July 29, 2026 21:25
View session
Matthew Sainsbury (Microsoft) (mattsains-msft)
enabled auto-merge (squash)
July 29, 2026 21:26
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses crashes when TelemetryConfiguration.FeatureReporter is not initialized (notably when no connection string is configured), by making feature-reporting calls null-safe across TelemetryClient and TelemetryClientExtensions.
Changes:
- Guard
FeatureReporter.MarkFeatureInUse(...)calls with the null-conditional operator (?.) to preventNullReferenceException. - Apply the same null-safety pattern broadly across several
TelemetryClient.Track*APIs andStartOperationoverloads. - Add a changelog entry documenting the fix (with a small wording nit noted in review comments).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| CHANGELOG.md | Documents the fix for #3197 (wording can be tightened). |
| BASE/src/Microsoft.ApplicationInsights/TelemetryClientExtensions.cs | Prevents StartOperation from throwing when FeatureReporter is null. |
| BASE/src/Microsoft.ApplicationInsights/TelemetryClient.cs | Prevents multiple Track* APIs from throwing when FeatureReporter is null. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Harsimar Kaur (harsimar)
approved these changes
Jul 30, 2026
Rajkumar Rangaraj (rajkumar-rangaraj)
approved these changes
Jul 30, 2026
Matthew Sainsbury (Microsoft) (mattsains-msft)
merged commit Jul 30, 2026
f1ab279
into
microsoft:main
18 checks passed
Matthew Sainsbury (Microsoft) (mattsains-msft)
deleted the
feature-reporter-uninitialized
branch
July 30, 2026 16:38
This was referenced Oct 12, 2026
Open
Merged
Closed
This was referenced Oct 13, 2026
Open
Open
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #3197
Changes
FeatureReporter was being called without checking if it is null (for example, when a connection string is not set)
Checklist