Breaking change - Open generic types
See original GitHub issueHello,
I have a problem with the changes due to the commit f2bd7d7. In my assembly, I have a class like this :
public class OpenGeneric<T> : IOpenGeneric<T> { }
public interface IOpenGeneric<T> : IOtherInheritance { }
public interface IOtherInheritance { }
When I do .AsImplementedInterfaces(), I now obtain an error (this class was excluded before the changes) : 'Cannot instantiate implementation type 'Scrutor.Tests.OpenGeneric1[T]' for service type 'Scrutor.Tests.IOtherInheritance'.'
So, perhaps it would be nice to have an option to disable autoregistration for open generic types. Otherwise (better option), the IOtherInheritance interface should be excluded from the registration.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Is Changing A Generic Parameter's Name A Breaking ...
No, there is no such case. Changing the name of a generic type parameter is no more a breaking change than changing the...
Read more >Allow open generics to be included in AllClasses scan #42
The container supports registration of open generics, so it'... ... Breaking change - Open generic types #44.
Read more >Breaking changes in Swift 6 - Discussion
Many generic types only have a single parameter with a more or less obvious meaning, but in more complex setups, labels become more...
Read more >CA1005: Avoid excessive parameters on generic types
How to fix violations. To fix a violation of this rule, change the design to use no more than two type parameters. When...
Read more >Why is type erasure bad? If generic types were reifiable ...
Doing instanceOf checks on open types is a bad practice, as the code will be fragile to future changes, and the behavior not...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you for confirming the fix 😁
Yes, perfect, it fixes my problem.
Thank you very much for the responsiveness (and for sharing this useful project).