This is a migrated thread and some comments may be shown as answers.

Cannot call SatisfyImports in a MEF/Prism Application

2 Answers 73 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Alexandre
Top achievements
Rank 2
Alexandre asked on 31 Dec 2011, 02:38 AM

When trying to call:

CompositionInitializer.SatisfyImports(this);

I receive that message:

Cannot call SatisfyImports on a object of type 'x' because it is marked with one or more ExportAttributes.

In my ShellViewModel class, i have the following:

        public const string IsBusyPropertyName = "IsBusy";
        private bool _isBusy = false;
        [Export]
        public bool IsBusy
        {
            get { return _isBusy; }
            set
            {
                if (_isBusy == value)
                {
                    return;
                }
                _isBusy = value;
                RaisePropertyChanged(IsBusyPropertyName);
            }
        }
 
        [Import(typeof(IDataService), RequiredCreationPolicy = CreationPolicy.Shared)]
        public IDataService _DataService { getset; }

If i comment the [Export] tag, everything works. Why this happens?
But i comment that tag, the import will not work.

Is there a way to bypass this?

Here is the url for the a simple demo that shows demostrate that issue:

http://www.brim.com.br/silverlight/mefsatisfyimports.zip

Thanks!

2 Answers, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 02 Jan 2012, 12:36 PM
Hello Alexandre Costa,

Which control from the RadControls for Silverlight suite do you have an issue with ?

Kind regards,
Pavel Pavlov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Alexandre
Top achievements
Rank 2
answered on 02 Jan 2012, 01:41 PM
Hi Pavel,

In fact this problem is not related to Telerik components. I think that this problem is related to the MEF. I wonder if anyone has the same issue and found a solution. In the examplehttp://www.brim.com.br/silverlight/mefsatisfyimports.zip shows how this exception occurs.
Tags
General Discussions
Asked by
Alexandre
Top achievements
Rank 2
Answers by
Pavel Pavlov
Telerik team
Alexandre
Top achievements
Rank 2
Share this question
or