1

I have a MAF AddIn so i can show a Windows Forms application from WPF app. It all works perfectly when run from Visual Studio in vshost but when I run the app outside VS then most of the time the AddIn process exits:

    public FrameworkElement GetAddInUI(bool recoverLayout)
    {            
        DC.Resolve<ILogger>().Info("GetAddInUI...");
        // the process exits here when not in VS
        INativeHandleContract inhc = scpAddInContract.GetAddInUI(recoverLayout);
        DC.Resolve<ILogger>().Info("GetAddInUI done.");
        FrameworkElement fe = null;
        DC.Resolve<ILogger>().Info("ContractToViewAdapter...");
        DC.Resolve<ISynchronizationService>().Invoke(() =>
        {
            fe = FrameworkElementAdapters.ContractToViewAdapter(inhc);                
        });

        DC.Resolve<ILogger>().Info("ContractToViewAdapter done");

        return fe;
    }

    public INativeHandleContract GetAddInUI(bool recoverLayout)
    {
        INativeHandleContract value = null;
        dispatcher.DoWork(() => value = new IMyNativeHandle(FrameworkElementAdapters.ViewToContractAdapter(scpAddInView.GetAddInUI(recoverLayout))));

        return value;
    }

Do you have any experience with MAF and can possibly explain what kind of difference running it under vshost can make?

4

0 回答 0