pardahlman / RawRabbit

A modern .NET framework for communication over RabbitMq
MIT License
746 stars 144 forks source link

UsePolly(...) extension throws dependency injection error #354

Open videege opened 6 years ago

videege commented 6 years ago

When using the Polly enricher, the following line will always throw a dependency injection error because the ConnectionPolicies property of the options object is null.

https://github.com/pardahlman/RawRabbit/blob/6229f5285d2cb5b9370ebfb616de2977d0386e24/src/RawRabbit.Enrichers.Polly/PollyPlugin.cs#L13

pardahlman commented 6 years ago

Thanks for reporting this. How do you suggest we fix this? I'd be happy to review a PR for this 👍

videege commented 6 years ago

I solved it by just using the other constructor and specifying a new PolicyOptions(...) object with the ConnectionPolicies property also initialized but having none of its properties set. This seems to work just fine but will this have any negative consequences downstream?

dcagnetta commented 6 years ago

@videege could you post your code ?

Running into the same issue

houseofcat commented 6 years ago

Is it possible you guys are not assigning the Action to a Action?

This isn't super helpful sounding, but this UnitTest for example works for me: https://github.com/pardahlman/RawRabbit/blob/6229f5285d2cb5b9370ebfb616de2977d0386e24/test/RawRabbit.Enrichers.Polly.Tests/Middleware/QueueDeclareMiddlewareTests.cs