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.

Breaking change - Open generic types

See original GitHub issue


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:closed
  • Created 6 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

khellangcommented, Mar 13, 2018

Thank you for confirming the fix 😁

kakonecommented, Mar 13, 2018

Yes, perfect, it fixes my problem.

Thank you very much for the responsiveness (and for sharing this useful project).

Read more comments on GitHub >

github_iconTop 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 >

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 Post

No results found

github_iconTop Related Hashnode Post

No results found