runtime: System.Net.Http.dll should throw NotImplementedException instead of DllNotFoundException

When sending HTTP request with HttpClient on CoreCLR + *nix, the following exception is thrown:

Unhandled Exception: System.DllNotFoundException: Unable to load DLL 'winhttp.dll': Error 126 (Exception from HRESULT: 0x8007007E)
   at System.Net.Http.Interop.WinHttpSetStatusCallback(SafeInternetHandle handle, WINHTTP_STATUS_CALLBACK callback, UInt32 notificationFlags, IntPtr reserved)
   at System.Net.Http.WinHttpHandler.SetStatusCallback(SafeInternetHandle requestHandle, WINHTTP_STATUS_CALLBACK callback)
   at System.Net.Http.WinHttpHandler.<StartRequest>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<ThrowAsync>b__4(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
libc++abi.dylib: terminating with uncaught exception of type PAL_SEHException
Abort trap: 6

It is better to use a more friendly exception.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 21 (9 by maintainers)

Most upvoted comments

If it helps anyone, I ran into this today using "System.Net.Http" : "4.0.0", but I bumped it up to 4.3.0 and everything is good now running on Linux in the AWS Lambda execution environment.