Hi
We are trying to move to a multi-process ui hosting framework where plug-ins are hosted in their own process and the top-level visual component is not a Window, but a ViewToContractAdapter from the Addins namespace:
defined in System.Windows.Presentation.dll
namespace System.AddIn.Pipeline
{
// Summary:
// System.AddIn.Pipeline.FrameworkElementAdapters is used by Windows Presentation
// Foundation (WPF) add-ins to convert between a System.Windows.FrameworkElement
// and an System.AddIn.Contract.INativeHandleContract.
public static class FrameworkElementAdapters
{
// Summary:
// Returns a System.Windows.FrameworkElement that has been converted from an
// System.AddIn.Contract.INativeHandleContract.
//
// Parameters:
// nativeHandleContract:
// The System.AddIn.Contract.INativeHandleContract that was passed across the
// isolation boundary between the host application and the add-in.
//
// Returns:
// A System.Windows.FrameworkElement that will be displayed from either the
// host application or add-in, depending on the direction in which the UI is
// passed between the two.
[SecurityCritical]
public static FrameworkElement ContractToViewAdapter(INativeHandleContract nativeHandleContract);
//
// Summary:
// Returns an System.AddIn.Contract.INativeHandleContract that has been converted
// from a System.Windows.FrameworkElement.
//
// Parameters:
// root:
// The System.Windows.FrameworkElement to be passed across the isolation boundary
// between the host application and the add-in.
//
// Returns:
// An System.AddIn.Contract.INativeHandleContract that is passed from either
// the host application or the add-in, depending on the direction in which the
// UI is passed between the two.
//
// Exceptions:
// System.InvalidOperationException:
// root is not the root element of a tree of elements.
[SecurityCritical]
public static INativeHandleContract ViewToContractAdapter(FrameworkElement root);
}
}
After switching to this, I am running into problems. So far I noticed 2 below. Do you assume that the top level control is a window anywhere in your code?
- I cannot close the the popups that hold BarSubItems. Once opened. they stay opened.
- I get this exception when showing/hiding TabLayoutPanel of the DevExpress DockLayoutManager
2015-10-28 13:41:48,432 [1] ERROR ModuleHost.Activation.Program - Exception: System.InvalidOperationException: An infinite loop appears to have resulted from repeatedly invalidating the TimeManager during the Layout/Render process.
at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run()
at ModuleHost.Activation.Program.RunMain(Stopwatch sw) in c:\Code\HIBISCUS-4.0\Source\Framework\ModuleHost\Activation\Program.cs:line 110
at ModuleHost.Activation.Program.Main(String[] args) in c:\Code\HIBISCUS-4.0\Source\Framework\ModuleHost\Activation\Program.cs:line 35
Hi,
It is difficult to resolve this issue based only on the provided information. Would you please provide us with a simple working project that illustrates the issue in action. With a small example project, it is much easier for us to verify that the code that calls ours is valid, and that the way our controls are being used is recommended. This way, we can concentrate our resources on the problematic area: A request for simple example programs Your time and cooperation are greatly appreciated.
Thanks,
Andrey
OK try the attached sample. It's based on the BaktunShell that I got from CodeProject and it uses same cross-process wpf hosting technology.
To confirm proper behavior, compile the BaktunShell.sln solution, make the SampleProject as the startup project and run it. You will see a window with a toolbar. Clicking on the 2 container menu bars will show you a popup and clicking back into the window will hide the popup. Now stop the run, make the Shell project as a Startup Project and run it again.
When window comes up, select "SamplePlugin" in the assembly dropdown, select SamplePlugin.DevExpressPlugin as the class and click Load.
Now, when you dropdown the "Load Common Data 1" menu the popup gets to be sticky. There's no way to toggle it anymore. You can even move the container window around and still have the popup.
I hope there's a workaround.
OK, Let's focus only on #1.
The problem number 2 above, the exception is reproducible without the multi-process host. Please see attached zip file for reproduction of the exception (#2)
Hi Alex,
To process your recent post more efficiently, I created a separate ticket on your behalf for the second problem you reported: T305577: DockLayoutManager raises System.InvalidOperationException when showing/hiding TabLayoutPanels. Both these tickets are currently in our processing queue. Our team will address them as soon as possible.
Hi Alex,
Thank you for your sample project. I have reproduced the issue with the menu and passed this ticket to our developers for further research. We will update this thread as soon as we make any progress.
Thanks,
Alexander
Any luck?
Our developers are still working on this issue. We will let you know once we find a fix.
When are you planning to release 15.1.8?
Hello,
In general, we plan to release version 15.1.8 this month. However, we cannot provide you with any precise date when this version will be released. Follow our announcements on our website to be informed about our releases.
Thanks,
Kirill