question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Make the constructors of the Policy abstract base classes protected, not internal [allow custom policies]

See original GitHub issue

The constructors of the Policy and Policy<TResult> abstract base classes are internal but should be made ~public~protected.

This would allow users to implement new custom policies, outside of the Polly package, deriving from these base classes.

Needed in files Policy.cs, Policy.TResult.cs, PolicyAsync.cs, PolicyAsync.TResult.cs.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
reisenbergercommented, Aug 22, 2017

Thanks all for all the great comments. Hoping to come back to this and #299 before the end of the week.

0reactions
reisenbergercommented, Jan 2, 2018

Closed by #391

The options for compenentisation discussed in the previous comment (thanks for the valuable discussion) remain options for a future version of Polly or any similar product. As discussed above, a rewrite to such a structure would be intellectually well motivated (and does appeal). It would require a significant chunk of time tho (and would lead to a significantly different syntax experience for users).

( EDIT: Very happy to discuss any ideas around this, and/or support anyone who wants to explore them. )

Read more comments on GitHub >

github_iconTop Results From Across the Web

Constructor of an abstract class in C# - Stack Overflow
when declaring public constructors in abstract classes however it will not allow creating a new instance.
Read more >
Access modifier of abstract class constructors
It seems like the access modifier is superfluous and should be implicitly protected since it can only be used from within a derived...
Read more >
Constructors of an "abstract" class should not be declared ...
Abstract classes should not have public constructors. Constructors of abstract classes can only be called in constructors of their subclasses.
Read more >
CA1012: Abstract types should not have public constructors
Rule description​​ Constructors on abstract types can be called only by derived types. Because public constructors create instances of a type and ...
Read more >
Are protected fields really bad practice? : r/java
The abstract class has a few fields which are exclusively used in the subclasses. We are forced to make them private and use...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found