Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Depend on a signed version of the Polly library #286

Closed
rvanmaanen opened this issue Apr 30, 2018 · 9 comments
Closed

Depend on a signed version of the Polly library #286

rvanmaanen opened this issue Apr 30, 2018 · 9 comments

Comments

@rvanmaanen
Copy link

rvanmaanen commented Apr 30, 2018

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.

@iancooper
Copy link
Member

I hate signed assemblies. I despise the ground they were built on.

That said, we will see what we can do to fix this. perhaps some sort of alternative package (although I am minded to call it Paramore.Brighter.Infected

@rvanmaanen
Copy link
Author

rvanmaanen commented Apr 30, 2018

Hehe, I can live with Infected ;-) Great that you brought it up at the Microsoft team too, let's see how this can be resolved.

@iancooper
Copy link
Member

So it looks like Polly are going to drop the unsigned version. That will clarify the ecosystem, but means we will have to release a new version of Brighter that uses the signed version of the code instead. We can do that, and probably should ahead of 2.1 RTM, We will have to notify our consumers of the issue, and their need to move to the signed version of Polly.

The pain point here is that we also have to upgrade our code as Polly has changed their interface, requiring us to change our code. We were going to do this anyway, but having to move forward versions will force our hand on doing this now.

@iancooper
Copy link
Member

We'll use this issue to track creating a version of Brighter that depends on a signed version of Polly, and track creating a signed version of Brighter separately.

@iancooper
Copy link
Member

Just to keep you in the picture. In order to create a version that depends on a signed version we have two dependencies. (1) We need to move to the latest Polly API as we are using obsolete features that won't be supported in that release (2) We need to wait for the signed-only version of Polly from this: App-vNext/Polly#442

The signed version of Brighter issue is here: #287

@iancooper iancooper changed the title Create a signed NuGet package too Depend on a signed version of the Polly library May 2, 2018
@rvanmaanen
Copy link
Author

Thanks, I was monitoring all the issues as well. We don't really need a signed version of Brighter (just a signed Polly), but thought you'd want to follow the current Polly strategy by creating a signed and non signed package. Looks like they will drop the non signed package, do you plan on doing the same in the future?

Anyway, thanks for fixing this!

@rvanmaanen
Copy link
Author

Polly 6.0.1 has been released!

@iancooper
Copy link
Member

Yeah, I just saw

@holytshirt
Copy link
Member

This is done, and pushed to NuGet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants