You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What do you think about removing the dependencies on Microsoft.AspNet.WebApi.Client and WinInsider.System.Net.Http.Formatting and replacing with our own code?
I did a preliminary review and it looks like we use the following classes from these packages:
MediaTypeFormatter: abstract class that describes a formatter (FluentClient already has a MediaTypeFormatter abstract class which is extremely similar)
MediaTypeFormatterCollection: very simple wrapper around Collection<MediaTypeFormatter> which makese sure the three default formatters are automatically added when a new instance of this collection is created
JsonMediaTypeFormatter: there used to be a class in the FluentClient project which was marked as obsolete and recently removed from the project. Maybe we could bring it back?
XmlMediaTypeFormatter: XML formatter
FormUrlMediaTypeFormatter: Form Url encoded formatter
ObjectContent: takes a formatter and an object and converts it into a string to be submitted
Sorry I forgot to mention the reason for my suggestion:
To work around the fact that Microsoft's WebApi Client nuget package is not .NET STANDARD compliant we found a 3rd party package that provides same functionality. The drawback is that some resources are missing from this 3rd party nuget package which causes 4 unit tests to fail in the FluentHttpClient project. Not ideal but not a huge deal either. You and I are aware, and we know to disregard the 4 failing tests.
However, I'm trying to use FluentHttpClient in one of my libraries and I'm getting more than 500 failing unit tests with the following error message:
Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "System.Net.Http.Properties.Resources.resources" was correctly embedded or linked into assembly "WinInsider.System.Net.Http.Formatting" at compile time, or that all the satellite assemblies required are loadable and fully signed.
I can't release my library with so many failing tests, To be honest, I suspect I have some underlying issue in my library but the real problem is obscured by the "missing resource" error message.
That's why I'm suggesting we should get rid of WinInsider.System.Net.Http.Formatting and Microsoft WebApi Client.
I removed the netcoreapp1.0 section from my testing project project.son to force my unit tests to only be executed under net452 (thereby eliminating the WinInsider package for debugging purposes) and, as I suspected, there is an underlying problem which immediately became quite evident: I am attempting to use the FormUrlEncodedMediaTypeFormatter when submitting my requests and, as we discussed in #50 , this formatter can only be used to read responses and cannot be used for writing requests. This results in the following error: The configured formatter 'System.Net.Http.Formatting.FormUrlEncodedMediaTypeFormatter' cannot write an object of type 'List1'.`
To summarize, there is an underlying error in my code which I need to resolve but the WinInsider obscured the problem by throwing an exception regarding missing resource.
I found a solution for my "underlying" problem (solution described in #50). So, as far as I'm concerned, removing the WinInsider package is not as urgent as I originally thought.
However, the problem remains: when something goes wrong, the WinInsider package is unable to throw the appropriate exception due to missing resource and instead throws Could not find any resources appropriate for ... which obscures the real problem and makes it very hard for developers to figure out what's wrong.
Is this something we can live with until Microsoft updates their WebApi Client?
I think so. It's a workaround for .NET Core compatibility until Microsoft updates their packages, which will hopefully happen alongside .NET Core 2.0 in the next few months. I'd rather deal with that issue temporarily than remove support for the standard media type formatters.
I tend to agree with you. I freaked out when I saw 500+ of my unit tests failing and just a generic exception without any helpful message. But fortunately, I had an intuition about the underlying problem and I was able to figure out a workaround so I am not as alarmed as I was.
Activity
Pathoschild commentedon Feb 11, 2017
I think compatibility with existing media type formatters is a big plus. What's the advantage to moving away from the main formatting library?
Jericho commentedon Feb 11, 2017
Sorry I forgot to mention the reason for my suggestion:
To work around the fact that Microsoft's WebApi Client nuget package is not .NET STANDARD compliant we found a 3rd party package that provides same functionality. The drawback is that some resources are missing from this 3rd party nuget package which causes 4 unit tests to fail in the FluentHttpClient project. Not ideal but not a huge deal either. You and I are aware, and we know to disregard the 4 failing tests.
However, I'm trying to use FluentHttpClient in one of my libraries and I'm getting more than 500 failing unit tests with the following error message:
I can't release my library with so many failing tests, To be honest, I suspect I have some underlying issue in my library but the real problem is obscured by the "missing resource" error message.
That's why I'm suggesting we should get rid of WinInsider.System.Net.Http.Formatting and Microsoft WebApi Client.
Jericho commentedon Feb 12, 2017
I removed the
netcoreapp1.0section from my testing project project.son to force my unit tests to only be executed under net452 (thereby eliminating the WinInsider package for debugging purposes) and, as I suspected, there is an underlying problem which immediately became quite evident: I am attempting to use the FormUrlEncodedMediaTypeFormatter when submitting my requests and, as we discussed in #50 , this formatter can only be used to read responses and cannot be used for writing requests. This results in the following error:The configured formatter 'System.Net.Http.Formatting.FormUrlEncodedMediaTypeFormatter' cannot write an object of type 'List1'.`To summarize, there is an underlying error in my code which I need to resolve but the WinInsider obscured the problem by throwing an exception regarding missing resource.
Jericho commentedon Feb 12, 2017
I found a solution for my "underlying" problem (solution described in #50). So, as far as I'm concerned, removing the WinInsider package is not as urgent as I originally thought.
However, the problem remains: when something goes wrong, the WinInsider package is unable to throw the appropriate exception due to missing resource and instead throws
Could not find any resources appropriate for ...which obscures the real problem and makes it very hard for developers to figure out what's wrong.Is this something we can live with until Microsoft updates their WebApi Client?
Pathoschild commentedon Feb 12, 2017
I think so. It's a workaround for .NET Core compatibility until Microsoft updates their packages, which will hopefully happen alongside .NET Core 2.0 in the next few months. I'd rather deal with that issue temporarily than remove support for the standard media type formatters.
Jericho commentedon Feb 12, 2017
I tend to agree with you. I freaked out when I saw 500+ of my unit tests failing and just a generic exception without any helpful message. But fortunately, I had an intuition about the underlying problem and I was able to figure out a workaround so I am not as alarmed as I was.