Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logic bug within Initialize(..,..) in TelemetryContext : null-conditional operator comparison is always null #692

Closed
DanSmith opened this issue Jan 11, 2018 · 1 comment
Labels
Milestone

Comments

@DanSmith
Copy link

Hi,

I have set several default properties on a TelemetryClient's Context and they seem to not be copied over to custom events and exceptions.

I think the issue started when the Initialize method in TelemetryContext was updated here in this commit:

e0208cd#diff-3d363b608e70a044e45f704453bce8de

If the private context fields of the new TelemetryContext are null, the ? operator will always fail to call the copy from the source.

This logic was previously reversed prior to the mentioned commit where the call would copy the source if the source wasn't null, which use to work as expected.

Repro Steps

  1. Set client.Context.Component.Version = "some version"
  2. Create a new EventTelemetry and call TrackEvent on the client

Actual Behavior

Component.Version, ai.application.ver, isn't set, serialized, or reported to the endpoint.

Expected Behavior

ai.application.ver is included in the tags in the json serialization

Version Info

SDK Version : dotnet:2.5.0-55494
.NET Version : 4.5

@DanSmith DanSmith changed the title Issue with Initialize in TelemetryContext Logic bug within Initialize in TelemetryContext - null-conditional operator comparison is always null Jan 25, 2018
@DanSmith DanSmith changed the title Logic bug within Initialize in TelemetryContext - null-conditional operator comparison is always null Logic bug within Initialize(..,..) in TelemetryContext : null-conditional operator comparison is always null Feb 6, 2018
@TimothyMothra TimothyMothra added this to the 2.5.1 milestone Feb 21, 2018
@TimothyMothra
Copy link
Member

Today we released Microsoft.ApplicationInsights (v2.5.1) and Microsoft.ApplicationInsights.Web (v2.5.1) with this fix.

TimothyMothra pushed a commit that referenced this issue Oct 25, 2019
Dev to master for 2.3 stable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants