Resolution of the dependency failed

Topics: Prism v2 - Silverlight 2
Mar 18, 2009 at 4:13 PM
Hello,

I am trying to use Prims but I get the following Error messag:

Resolution of the dependency failed, type = "RiaCrm.EditRecord.EditRecordView", name = "". Exception message is: The current build operation (build key Build Key[RiaCrm.EditRecord.EditRecordView, null]) failed: The parameter viewModel could not be resolved when attempting to call constructor RiaCrm.EditRecord.EditRecordView(RiaCrm.EditRecord.EditRecordViewModel viewModel). (Strategy type BuildPlanStrategy, index 3)

And it seems like the error is caused by this guy:
-----
eventAggregator.GetEvent<DynamicEntityGridSelecteIndexChanged>().Subscribe(OnDynEntityGridSelectionChanged);
-----

The line of code is located in the consturctor:
-----
public EditRecordViewModel(IEventAggregator eventAggregator)
        {
            this.RegisteredPicklists = new Dictionary<string, CrmPicklistControl>();
            //this._metadatalayer = metadatalayer;

            eventAggregator.GetEvent<DynamicEntityGridSelecteIndexChanged>().Subscribe(OnDynEntityGridSelectionChanged);
        }

-----

The error message is throw in the UnityServiceLocatorAdapter class in the following method':
-----
 protected override object DoGetInstance(Type serviceType, string key)
        {
            return _unityContainer.Resolve(serviceType, key);
        }

-----

I dont understand the errormessage.... why do i need to register my View? I already implemented an different module (with not eventAggregation) and it works without the registartion of the view...




Mar 18, 2009 at 4:46 PM
Dammit...
my callback method OnDynEntityGridSelectionChanged was private and not public.....

Sorry for the unnecessary post.
Aug 3, 2009 at 9:01 AM

The post is by no means unnecessary. The error message is unintuitive and one could waste a lot of time looking for the reason of such a silly problem.

Aug 3, 2009 at 6:21 PM
Edited Aug 3, 2009 at 6:21 PM

Ditto, I remember chasing my tail on this one also...  "We" only get fooled by this once but perhaps your post will help the next guy...