This project has moved. For the latest updates, please go here.

My Views are not imported when exception from Ria is trapped

Mar 21, 2012 at 10:06 AM


I am currently working on a OOB application and using MEF. Oneof  my requirement is to check if the Ria Service is reachable. 

For checking I do this:

public static void IsServiceReachable(Action onServiceAvailable, Action onServiceUnavailable)
            try {
                DomainContext context = new DomainContext();

                InvokeOperation<bool> invokeOperation = context.IsAlive();
                invokeOperation.Completed += (s, arg) => onServiceAvailable();
            catch (Exception) {

Once my shell loads and I now know that ria is unreachable I load my Views with

My views are declared as:

  [ImportMany(AllowRecomposition = true)]
  public Lazy<BaseUserControl, IViewMetadata>[] Views { get; set; }


If no exception is trapper, Views are loaded successfully, on the other hand if an exception occurred no views are loaded.