Closed gbrunton closed 4 years ago
Here's the error and stack trace from
var testClass = container.GetInstance<TestClass>();
Lamar.IoC.LamarMissingRegistrationException : No service registrations exist or can be derived for netcore.tests.web.UnitTests.ExtensionMethods.IServiceCollectionExtensionsTests.When_creating_a_new_instance_after_applying_the_AddTransientForAll_rule.TestClass at Lamar.IoC.Scope.GetInstance(Type serviceType) at Lamar.IoC.Scope.GetInstance[T]() at netcore.tests.web.UnitTests.ExtensionMethods.IServiceCollectionExtensionsTests.When_creating_a_new_instance_after_applying_the_AddTransientForAll_rule..ctor()
@gbrunton All the unit tests for that behavior are passing in CI and for me locally. What else is going on there? That's an old feature and hasn't changed. It looks like an inner type, is the parent type an internal maybe?
I can't reproduce what you're seeing above.
@jeremydmiller I was surprised that this wasn't working for me too. I've since moved away from Lamar and am now just using the built in .net container.
As I remember this was a parent type and not an inner type. I'm fine if you can't replicate it and want to just close this.
Thank you for looking into it though.
The following documentation is not working for multiple reasons:
https://jasperfx.github.io/lamar/documentation/ioc/resolving/requesting-a-concrete-type/
First the documentation states that you can new up a Container with a default constructor which is not true. Secondly the following is not working for me.
var container = new Container(registry => { });
var testClass = container.GetInstance<TestClass>();
public class TestClass {}
Any suggestions on how to get concrete types to auto resolve would be appreciated.