Issue trying to integrate HelloScreens into WPF project

Jan 24, 2011 at 9:25 PM

I have an existing WPF project that I am trying to add the DialogManager code from the HelloScreens sample project into. I have added the necessary interfaces/classes, but get the following error in the GetInstance function when MEF is composing things:

GetExportedValue cannot be called before prerequisite import Sample.ViewModels.ShellViewModel..ctor (Parameter="dialogs", ContractName="Sample.Core.Contracts.IDialogManager")' has been set.

The issue lies in my ShellViewModel. I am importing another viewmodel via the following code:

 [ImporttypeofIRibbonBar ), AllowDefault = true )]
        public IRibbonBar RibbonBar
                return _RibbonBar;
                _RibbonBar = value;
                NotifyOfPropertyChange( () => RibbonBar );

If I comment this out, everything works fine. The only thing I found regarding this error was on this page:

However, implementing his suggested fix has no effect. Any thoughts?

Jan 24, 2011 at 11:56 PM

You should probably ask this question in the MEF forums. If I had to guess though, the implementation of IRibbonBar probably has some sort of circular dependency.