Kevin Gosse 8/14/2020

Tricked by WebRequest

Read Original

The article details a bug encountered in the Datadog .NET tracer when switching from HttpClient to HttpWebRequest. A customer's custom WebRequest factory caused an InvalidCastException. The author explains the root cause—global WebRequest prefix overrides—and reveals the solution: using WebRequest.CreateHttp to guarantee an HttpWebRequest instance, along with challenges in writing unit tests for this scenario.

Tricked by WebRequest

Comments

No comments yet

Be the first to share your thoughts!

Browser Extension

Get instant access to AllDevBlogs from your browser

Top of the Week