Posts

Showing posts with the label CLR

unexpected WM_PAINT message reentry when waiting for COM request under Vista/7

Recently, we had a weird problem: when CLR is waiting for the COM request result, especially a remoting one, the WM_PAINT message can be processed before it returns. We are waiting the COM request in rendering thread, and assumes that the code should be blocked and does not consider reenter problem. This really cause lots of trouble. When the problem happened, the callstack trace looks like below:   1: UIFramework.dll!UIFramework.MainForm.viewport_Paint 2: System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.WndProc(ref System.Windows.Forms.Message m) + 0x31 bytes 3: System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.DebuggableCallback(System.IntPtr hWnd, int msg = 15, System.IntPtr wparam, System.IntPtr lparam) + 0x57 bytes 4: ... 5: user32.dll!_DispatchMessageW@4() + 0xf bytes 6: ole32.dll!CCliModalLoop::HandleWakeForMsg() + 0x48c30 bytes 7: ole32.dll!CCliModalLoop::BlockFn() - 0x5df7 bytes 8: ole32...