Problem Adding Module

Nov 7, 2009 at 11:55 PM

I'm working on my first Unity application and am having a problem.  I've reviewed samples and coded my application.  Now as application is starting after bootstrap operation, I'm getting the following error message -

An exception occurred while initializing module 'ListUrlControlModule'.
    - The exception message was: Activation error occured while trying to get instance of type ListUrlControlModule, key ""
    Check the InnerException property of the exception for more information. If the exception occurred
    while creating an object in a DI container, you can exception.GetRootException() to help locate the
    root cause of the problem.

Below is my bootstrap code -

using System.Windows;
using Microsoft.Practices.Composite.Modularity;
using Microsoft.Practices.Composite.UnityExtensions;
using WebSiteMon.ListUrls;
using ModuleA;

namespace WebSiteMon
{
    public class Bootstrapper : UnityBootstrapper
    {
        protected override DependencyObject CreateShell()
        {
            Shell shell = new Shell();
            Application.Current.MainWindow = shell;
            shell.Show();
            return shell;
        }

        protected override IModuleCatalog GetModuleCatalog()
        {
            var catalog = new ModuleCatalog();
            catalog.AddModule(typeof(WebSiteMon.ListUrls.ListUrlControlModule));
            return catalog;
      }
    }
}

this is my module code -

using Microsoft.Practices.Composite.Modularity;
using Microsoft.Practices.Composite.Regions;

namespace WebSiteMon.ListUrls
{

    public class ListUrlControlModule : IModule
    {
        private readonly IRegionManager _regionManager;
        public ListUrlControlModule(IRegionManager regionManager)
        {
            _regionManager = regionManager;
        }

        #region IModule Members

        public void Initialize()
        {
            this._regionManager.Regions["MainRegion"].Add(new ListUrlControl());
        }

        #endregion
    }
}

 

If the Quickstart samples, I modified the bootstrap routine to call ModuleA from DefiningModulesInCode_Desktop Sample.  When I run this, it runs without any problems.  I've compared my code with the ModuleA and cannot see any structural differences.

My initial feelings are that this looks like a really neat framework and am looking forward to using it more.

 

Nov 8, 2009 at 12:15 AM

Sorry to  bother everyone, I just found my problem.  I had an exception being thrown constructing the of my ViewModel.