Hello,
I have a program that, each time I open a new file on it creates a new main window on its own thread.
Everything is working OK, except on the following scenario:
- A file in opened in the application main window.
- A second file is opened in a new main window.
- In this second main window, a RadWindow is opened.
- The RadWindow is moved.
At this time, the application crashes with the following exception and stack trace:
The calling thread cannot access this object because a different thread owns it. Exception {InvalidOperationException}
WindowsBase.dll!System.Windows.Threading.Dispatcher.VerifyAccess() Unknown
PresentationFramework.dll!System.Windows.Application.MainWindow.get() Unknown
Telerik.Windows.Controls.Navigation.dll!Telerik.Windows.Controls.InternalWindow.ChromelessWindowHelper.GetDpiIndependentPrimaryScreenSize() Unknown
Telerik.Windows.Controls.Navigation.dll!Telerik.Windows.Controls.InternalWindow.ChromelessWindowHelper.HandleGetMinMaxInfo(System.IntPtr hwnd = {System.IntPtr}, System.IntPtr wParam = {System.IntPtr}, System.IntPtr lParam = {System.IntPtr}, out bool handled = false) Unknown
Telerik.Windows.Controls.Navigation.dll!Telerik.Windows.Controls.InternalWindow.ChromelessWindowHelper.WndProc(System.IntPtr hwnd = {System.IntPtr}, int msg = 36, System.IntPtr wParam = {System.IntPtr}, System.IntPtr lParam = {System.IntPtr}, ref bool handled = false) Unknown
PresentationCore.dll!System.Windows.Interop.HwndSource.PublicHooksFilterMessage(System.IntPtr hwnd = {System.IntPtr}, int msg, System.IntPtr wParam = {System.IntPtr}, System.IntPtr lParam = {System.IntPtr}, ref bool handled = false) Unknown
WindowsBase.dll!MS.Win32.HwndWrapper.WndProc(System.IntPtr hwnd = {System.IntPtr}, int msg, System.IntPtr wParam = {System.IntPtr}, System.IntPtr lParam = {System.IntPtr}, ref bool handled = false) Unknown
WindowsBase.dll!MS.Win32.HwndSubclass.DispatcherCallbackOperation(object o) Unknown
WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs) Unknown
WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(object source = {System.Windows.Threading.Dispatcher}, System.Delegate callback, object args, int numArgs, System.Delegate catchHandler = null) Unknown
WindowsBase.dll!System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority priority, System.TimeSpan timeout, System.Delegate method, object args, int numArgs) Unknown
WindowsBase.dll!MS.Win32.HwndSubclass.SubclassWndProc(System.IntPtr hwnd = {System.IntPtr}, int msg, System.IntPtr wParam = {System.IntPtr}, System.IntPtr lParam = {System.IntPtr}) Unknown
[Native to Managed Transition]
[Managed to Native Transition]
WindowsBase.dll!MS.Win32.HwndSubclass.DefWndProcWrapper(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam) Unknown
[Native to Managed Transition]
[Managed to Native Transition]
WindowsBase.dll!MS.Win32.HwndSubclass.SubclassWndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam) Unknown
[Native to Managed Transition]
[Managed to Native Transition]
WindowsBase.dll!MS.Win32.HwndSubclass.DefWndProcWrapper(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam) Unknown
[Native to Managed Transition]
[Managed to Native Transition]
WindowsBase.dll!MS.Win32.HwndSubclass.SubclassWndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam) Unknown
[Native to Managed Transition]
[Managed to Native Transition]
WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame frame = {System.Windows.Threading.DispatcherFrame}) Unknown
PresentationFramework.dll!System.Windows.Window.ShowHelper(object booleanBox) Unknown
PresentationFramework.dll!System.Windows.Window.ShowDialog() Unknown
Telerik.Windows.Controls.Navigation.dll!Telerik.Windows.Controls.InternalWindow.WindowWithNoChromeWindowHost.Open(bool isModal = true) Unknown
Telerik.Windows.Controls.Navigation.dll!Telerik.Windows.Controls.WindowBase.ShowWindow(bool isModal = true) Unknown
Telerik.Windows.Controls.Navigation.dll!Telerik.Windows.Controls.RadWindow.ShowDialog() Unknown
Note that doing the same on the first main window doesn't crash the application.