Description
Hi,
I was experimenting with the latest .NET Core 2.1 preview, especially the new feature that allows configuring HttpClients at startup, together with message handlers and errorhandling and then injecting a typed client. The errorhandling can be done with an very cool extension method from the NuGet package Microsoft.Extensions.Http.Polly. This is documented at Polly and HttpClientFactory
However, this extension method uses the signed version of Polly. Now the issue is that I'm using Brighter as well, which is using the unsigned version of Polly. This results in these nasty warnings: No way to resolve conflict between "Polly, Version=5.9.0.0, Culture=neutral, PublicKeyToken=c8a3ffc3f8f825cc" and "Polly, Version=5.9.0.0, Culture=neutral, PublicKeyToken=null". Choosing "Polly, Version=5.9.0.0, Culture=neutral, PublicKeyToken=c8a3ffc3f8f825cc" arbitrarily
It would be great if a Brighter-Signed package could be created, which uses signed packages where possible too. My next stop would then be Paramore.Brighter.AspNetCore to submit the same request there, as I'm using that NuGet package to add Brighter to my webservices. :)
You can see the warning yourself if you have a look at this solution: https://github.com/rvanmaanen/httpclientfactory-polly-brighter (you'll need the latest .net core 2.1 preview installed and preferably the latest preview of visual studio too)
Another issue that occurs too: When adding both Brighter and Microsoft.Extensions.Http.Polly, it's required to explicitly reference Polly-Signed too, else this error occurs: The type 'PolicyBuilder<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'Polly, Version=5.8.0.0, Culture=neutral, PublicKeyToken=c8a3ffc3f8f825cc'
. Probably has to do with the different versions of Polly being used together as well.
Ignoring all the above, you end up with a compile error which I can't get out of the way when trying to build my own Policy by doing something like var myPolicy = Policy.Handle<HttpRequestException>();
. The error is: The type 'Policy' exists in both 'Polly, Version=5.9.0.0, Culture=neutral, PublicKeyToken=null' and 'Polly, Version=5.9.0.0, Culture=neutral, PublicKeyToken=c8a3ffc3f8f825cc'
. I updated the code at https://github.com/rvanmaanen/httpclientfactory-polly-brighter to show this.