Azure / azure-storage-net

Microsoft Azure Storage Libraries for .NET
Apache License 2.0
446 stars 370 forks source link

Support RequestEventArgs.Response on .net core #670

Open elemount opened 6 years ago

elemount commented 6 years ago

Hi team, When we migrate code from .net framework to .net core, we got a blocking issue on monitor.

The RequestEventArgs do not support Response field on .net core. Code is here https://github.com/Azure/azure-storage-net/blob/68c3ee55a3a6f62a0159cea58005d3fe027312a8/Lib/Common/RequestEventArgs.cs#L52-L66

It is a real block issue.

joelverhagen commented 5 years ago

Yeah, I ran into this problem. I have a "core" library that has all my business logic and integration with the Azure Storage SDK. It is .NET Standard and uses RequestUri.

If the entry point is .NET Framework and pulls in this core library, it will fail at run time when it hits a code path in my "core" library that uses this method. It fails with a method not found exception on RequestUri.

This is because restore on the entry point project pulls in the net45 version of the storage SDK which does not have this property defined.

As a workaround, I can dual-target my "core" library to .NET Framework and .NET Core (net45 and netstandard1.3) then do my own #if NETCORE to either use RequestUri or Request. This is not ideal. Ideally RequestUri is available on all targets.

agnimitra commented 5 years ago

I am having the same problem while one of my migration. We were using RequestEventArgs.Response to detarmine weather the request failed on azure side of no. And our retry logic was based on that response. Can anyone help me in this regard.

Thanks, Agni