public static void PingProc(object o) { IProcessInitControl control = o as IProcessInitControl; try { for (int i = 0; i < 200; i++) { Thread.Sleep(0x2710); control.ResetInitializerTimeout(30); } } catch (ThreadAbortException) { } }
[SuppressMessage(FxCop.Category.Security, FxCop.Rule.AptcaMethodsShouldOnlyCallAptcaMethods)] // no identified security vulnerability that would justify making a breaking change public static void PingProc(object o) { IProcessInitControl control = o as IProcessInitControl; try { // This will loop for a max of 2000 seconds, which is a sanity check // that should never be hit. The assumption behind that is that // the main thread will not get stuck. It will either make progress // or fail with an exception, which will abort this thread and kill the process. // No COM app should take longer than 30 minutes to initialize since an app that // takes that long would have to be so big that it hits other limits before it hits this. for (int i = 0; i < 200; i++) { Thread.Sleep(10000); // Add 30 more seconds to the timeout control.ResetInitializerTimeout(30); } } catch (ThreadAbortException) { } }