stevejgordon / CorrelationId

An ASP.NET Core middleware component which synchronises a correlation ID for cross API request logging.
MIT License
558 stars 106 forks source link

HttpContext is null in asp.net core 2.2 #37

Closed pnguyen535 closed 4 years ago

pnguyen535 commented 5 years ago

There is a bug in asp.net 2.2 that make httpContext is null when TraceIdentifier is being updated. The work around to use this library is to set UpdateTraceIdentifier = false in CorrelationIdOptions

AdamSchueller commented 5 years ago

Also present in ASP.NET Core 2.1.3 - 2.1.7

Edit: Scratch that, I had a reference in my project that was overwriting the version of Microsoft.AspnetCoreHttp to 2.2.0 :\

image

tjrobinson commented 4 years ago

Duplicate of https://github.com/stevejgordon/CorrelationId/issues/34

stevejgordon commented 4 years ago

2.2.2 of ASP.NET Core fixed this.

tjrobinson commented 4 years ago

2.2.2 of ASP.NET Core fixed this.

Is it fixed in ASP.NET Core 3.x? I had a quick try yesterday and the problem still seemed to be there.

stevejgordon commented 4 years ago

@tjrobinson - It should be fixed there too. I've justed tested on a simple 3.1 project and can't seem to replicate the original issue I was aware of.

Are you able to provide a repro example of your case?

tjrobinson commented 4 years ago

@stevejgordon - apologies, I was testing it on the wrong branch of my application 🤦‍♂️

Everything works great now 👍🏻