Cannot call SatisfyImports in a MEF/Prism Application

3 posts, 0 answers
  1. Alexandre
    Alexandre avatar
    10 posts
    Member since:
    May 2009

    Posted 30 Dec 2011 Link to this post

    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. Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 02 Jan 2012 Link to this post

    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 >>

  3. DevCraft banner
  4. Alexandre
    Alexandre avatar
    10 posts
    Member since:
    May 2009

    Posted 02 Jan 2012 Link to this post

    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.
Back to Top