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.

DI stopped working after 9.4.0 update

See original GitHub issue

Hello.

I have updated a project that was using DNN 9.3.2 to 9.4.0 and my site has blown up with errors on all MVC controllers.

I tracked the problem to the dependency resolver not being able to resolve a dependecy. This is the constructor for one of the controllers that has stopped working.

public DefaultController(ITabService tabService)

I am using simple injector as dependency manager and have so in the past with no problems. The code for my simple injector container registration is this:

Container container = new Container();
container.Register<ITabService, TabService>(mixedScopeLifestyle);
container.Verify();
DependencyResolver.SetResolver(new SimpleInjectorDependencyResolver(container));
GlobalConfiguration.Configuration.DependencyResolver = new SimpleInjectorWebApiDependencyResolver(container);

From what I can tell, the new DNN 9.4.0 has introduced it’s own DI and my guess is that it’s messing with my implementation.

Is this expected behavior? I saw no mention of this issue anywhere.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:15 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
jsbsantoscommented, Oct 12, 2019

@ahoefling that’s great news.

I am using both MVC modules and Web API, that’s why I am registering the container twice (one statement for each). I will provide you with a code sample on monday when I get back to work if I can’t get it sooner.

Thanks for the helping me trying to sort this out.

1reaction
SkyeHoeflingcommented, Oct 11, 2019

@jsbsantos Let’s see what we can do to solve this problem, it will be a feature request and not necessarily a bug so depending where we land this might be something that doesn’t get merged until 10.x. If we can add support to this without making any breaking changes with minimal risk I will push to get it in 9.x (all depends on the final solution we land on).

I have read through the SimpleInjector documentation you shared several times, and even pulled their codebase that is being used for the ServiceCollection Extension method. At first glance this looks like something that should work, but I think I might know where DNN is running into problems.

As a general rule DNN should support IServiceCollection extension methods like this in the IDnnStartup as these are the recommended extension points in the library which will simplify the .NET Migration.

My Working Theory

I believe we just haven’t implemented support for what you are requesting, as all module patterns strictly use constructor injection. In the module pipeline we manually resolve the dependencies and construct the Controller for example.

I think we may be able to solve this problem, but I am going to need more information

What I Need

I need you to provide me a working code sample of the problem you are seeing with SimpleInjector which is not a code snippet here. I need an installer file so I can install it in a DNN website and the solution of demo project. If you can provide details on the features you are expecting to work as well and what isn’t working now.

With that code sample, I can really investigate and research to provide appropriate recommendations

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fixed Issues in ThingWorx Platform 9.4.0
Fixed an issue where a Bar Chart widget with multiples sources and multiples selections was not working correctly in ThingWorx - X Axis...
Read more >
View topic - [Solved] dhcpcd fails on boot - Gentoo Forums
You get dhcp for free when /etc/conf.d/net is missing. Rename it so it's not found and try again. I don't see a problem...
Read more >
No video hardware acceleration after Timeshift after Nvidia ...
I got that to work after a long fight by removing the Nvidia drivers and thus using the Intel driver. I made notes...
Read more >
Setting up the DI Operations Mart with a manual installation
When the installation progress is complete, click Quit. Your directory will contain the setup scripts and files used to create the default ...
Read more >
Voice no longer working on Linux viewers
Greetings! I'm a Linux user, my distribution is Manjaro KDE. I'm using two viewers to connect to SL: Kokua (main viewer) and Firestorm ......
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