Reputation: 336
0) How to debug unityContainer?
Im working on a legacy project on the firm, and all projects are loaded using dependency injection using unityContainer. I need to make improvements on the presentation layer, but I cannot debug the code, only the main project, witch loaded all modules.
The code used for loading modules(projects):
unityContainer.RegisterType("FrontEndModule", new InjectionMember[0]);
On the module, i register all project types like this:
unityContainer.RegisterType< IAboutPage, AboutPage>();
And then I run the main form:
Application.Run((Form) unityContainer.Resolve< IMainPage >() );
1) So there is any way to debug the code of the loaded projects?
2) Do I need to make any change to be able to debug? I've tried to run the form directly, but then there is a lot of injections needed to run. Maybe I would be able to use another IoC framework that permit me to debug the code of loaded projects.
Thanks.
Upvotes: 3
Views: 2941
Reputation: 100547
There is nothing special about Unity when you debug code.
To be able to steps through the code you need
If you can't get PDBs you still can see exceptions and call-stacks (as this information is part of DLL metainfo).
Switching to another DI framework will not have any impact on that.
Upvotes: 3