Skip to content

Commit b613b9e

Browse files
Added flag to check instead of return.
1 parent afe6551 commit b613b9e

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/Microsoft.AspNet.TelemetryCorrelation/TelemetryCorrelationHttpModule.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ private void Application_PreRequestHandlerExecute(object sender, EventArgs e)
9898
private void Application_EndRequest(object sender, EventArgs e)
9999
{
100100
AspNetTelemetryCorrelationEventSource.Log.TraceCallback("Application_EndRequest");
101+
bool trackActivity = true;
101102

102103
var context = ((HttpApplication)sender).Context;
103104

@@ -118,11 +119,14 @@ private void Application_EndRequest(object sender, EventArgs e)
118119
// The parent request jumps ahead in the pipeline to the end request notification, and waits for the child request to complete.
119120
// When the child request completes, the parent request executes the end request notifications and completes itself.
120121
// Ignore creating root activity for parent request as control got transferred from rewrite module to EndRequest with no request flow.
121-
return;
122+
trackActivity = false;
122123
}
123124
}
124125

125-
ActivityHelper.StopAspNetActivity(context.Items);
126+
if (trackActivity)
127+
{
128+
ActivityHelper.StopAspNetActivity(context.Items);
129+
}
126130
}
127131
}
128132
}

0 commit comments

Comments
 (0)