C# plugin - error 0x0000071A closing WPF window
-
I am writing a plugin in C# WPF.
The plugin can easily get a simple WPF window to display correctly in NPP…wpfAbout = new Views.About(); wpfAbout.Show();
However when the window is closed, the debug output shows…
Exception thrown at 0x73F008F2 (KernelBase.dll) in notepad++.exe: 0x0000071A: The remote procedure call was canceled, or if a call time-out was specified, the call timed out.
I’ve tried using WindowInteropHelper & HwndSource to wrap the WPF window in a Win32 window, and also played with different ways/order of destroying the Win32 wrapper and the WPF instance itself… in all cases the error occurs as soon as the wpf window is Closed.
This issue does not occur if I instead create/show a winforms form.
Any thoughts?
-
Using Spy++ I can see these messages to my WPF window/wrapper when NPP closes down…
<000015> 001A0C64 S WM_GETTEXT cchTextMax:512 lpszText:0012D7A8 <000016> 001A0C64 R WM_GETTEXT cchCopied:5 lpszText:0012E910 ("A") <000017> 001A0C64 S message:0x0090 [Unknown] wParam:00000000 lParam:00000000 <000018> 001A0C64 R message:0x0090 [Unknown] lResult:00000000 <000019> 001A0C64 S WM_WINDOWPOSCHANGING lpwp:0012FBFC <000020> 001A0C64 R WM_WINDOWPOSCHANGING <000021> 001A0C64 S WM_WINDOWPOSCHANGED lpwp:0012FBFC <000022> 001A0C64 R WM_WINDOWPOSCHANGED <000023> 001A0C64 S message:0x0272 [Unknown] wParam:00000000 lParam:00000000 <000024> 001A0C64 R message:0x0272 [Unknown] lResult:00000000 <000025> 001A0C64 S WM_DESTROY <000026> 001A0C64 R WM_DESTROY <000027> 001A0C64 S WM_NCDESTROY <000028> 001A0C64 R WM_NCDESTROY
Does anyone know what 0x0090 and 0x0272 messages are?
I hooked the messages in my WPF code which gave this:
MSG 90 (0, 0) = ??? MSG 46 (0, 1244516) = WM_WINDOWPOSCHANGING MSG 47 (0, 1244516) = WM_WINDOWPOSCHANGED MSG 272 (0, 0) = ??? The thread 0x2920 has exited with code 0 (0x0). MSG 2 (0, 0) = WM_DESTROY MSG 82 (0, 0) = WM_NCDESTROY Exception thrown at 0x73F008F2 (KernelBase.dll) in notepad++.exe: 0x0000071A: The remote procedure call was canceled, or if a call time-out was specified, the call timed out. The thread 0x1b9c has exited with code 0 (0x0).
Is it interesting that a thread exits after Msg 0x272 ? Perhaps NPP expects a non-zero reply to this message?