Can't resolve a registered class?

Issue #6 resolved
Nick Hodges created an issue

Okay, one of two things is going on here: either there is a bug somewhere or I don't know what the hell I'm doing. I'm happy with either outcome, and would prefer the latter.

Please unzip the following project, compile, run, and press the button. I get:


Debugger Exception Notification

Project Project49.exe raised exception class EResolveException with message 'Cannot resolve the dependency: TAnotherClass.'.

Break Continue Help

I'm more than happy to be shown what I'm doing wrong.....

Comments (3)

  1. Stefan Glienke repo owner

    You did not tell the container anywhere that you want to use the class itself as a service. It only does that in the resolve method by itself (which I consider kind of a hack so far - see the comment in the code there).

    If you just write RegisterType<TSomeClass> you actually did not specify any service.

    I am not sure if when calling Build (which you did not and which would lead to an exception later) there should be an exception that you did not specify any service type or that it should automatically register the class type as service type (as it does in the resolve method now).

    I am open for suggestions.

    To get around the bug for now you just have to write RegisterType<TAnotherClass, TAnotherClass> or RegisterType<TAnotherClass>.Implements<TAnotherClass>

  2. Log in to comment