2012-05-03 16 views
2

私はクライアントインストールで異常なアプリケーションハングを処理しています。 いくつかのことを試した後、ダンプがなければ動作しないという結論に達しました。 私はハングタイムに自分のクライアントからダンプを取った。 私のインストールでのみ発生し、開発用コンピュータでは発生しないことに注意してください。SystemEvents.OnUserPreferenceChangedイベントのためにWinFormsアプリケーションがハングアップする

私のダンプでは、SystemEvents.OnUserPreferenceChangedイベントにより、UIスレッドがメッセージをポンピングするスレッドを待つのをブロックすることが確認されています。

GoogleとGoogleで検索したところ、その問題がある人もいました。 私は、UIのスレッドではなく、運がないコントロールやフォームを作成したかどうかを調べるために、コードを調べました。

これは私!のclrstack

0012ee5c 7c90e514 [HelperMethodFrame_1OBJ: 0012ee5c] 
System.Threading.WaitHandle.WaitOneNative(Microsoft.Win32.SafeHandles.SafeWaitHandle, UInt32, Boolean, Boolean) 
0012ef08 792b68af System.Threading.WaitHandle.WaitOne(Int64, Boolean) 
0012ef24 792b6865 System.Threading.WaitHandle.WaitOne(Int32, Boolean) 
0012ef38 7b6f1a4f System.Windows.Forms.Control.WaitForWaitHandle(System.Threading.WaitHandle) 
0012ef4c 7ba2d68b System.Windows.Forms.Control.MarshaledInvoke(System.Windows.Forms.Control, System.Delegate, System.Object[], Boolean) 
0012efec 7b6f33ac System.Windows.Forms.Control.Invoke(System.Delegate, System.Object[]) 
0012f020 7b920bd7 System.Windows.Forms.WindowsFormsSynchronizationContext.Send(System.Threading.SendOrPostCallback, System.Object) 
0012f038 7a92ed62 Microsoft.Win32.SystemEvents+SystemEventInvokeInfo.Invoke(Boolean, System.Object[]) 
0012f06c 7a92dc8f Microsoft.Win32.SystemEvents.RaiseEvent(Boolean, System.Object, System.Object[]) 
0012f0b8 7a92e227 Microsoft.Win32.SystemEvents.OnUserPreferenceChanged(Int32, IntPtr, IntPtr) 
0012f0d8 7aaa06ec Microsoft.Win32.SystemEvents.WindowProc(IntPtr, Int32, IntPtr, IntPtr) 
0012f0dc 003c222c [InlinedCallFrame: 0012f0dc] 
0012f2a0 7b1d8d2e System.Windows.Forms.Application+ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32, Int32, Int32) 
0012f33c 7b1d8997 System.Windows.Forms.Application+ThreadContext.RunMessageLoopInner(Int32, System.Windows.Forms.ApplicationContext) 
0012f390 7b1d87e1 System.Windows.Forms.Application+ThreadContext.RunMessageLoop(Int32, System.Windows.Forms.ApplicationContext) 
0012f3c0 7b195931 System.Windows.Forms.Application.Run(System.Windows.Forms.Form) 
0012f3d4 034608b6 InsFocusBI.Presentation.MdiMain.NewMdiMainHandler(System.Object, NewSingleInstanceEventArgs) 
0012f3ec 034607ac InsFocusBI.Utilities.SingleInstanceHandler.Start(System.String[], System.String) 
0012f42c 0346021a InsFocusBI.Presentation.MdiMain.Run(System.String[]) 
0012f440 0346019b InsFocusBI.Presentation.MdiMain.Main(System.String[]) 
0012f688 79e71b4c [GCFrame: 0012f688] 

私は多分、私は他のスレッドで作成された制御であるかを把握することができますし、それは私に手掛かりを与えるダンプを使用していることを取り払わです。

私は、スタックのすべてのオブジェクトを取得するにはDSOみました:!iは見

OS Thread Id: 0x4f0 (0) 
ESP/REG Object Name 
0012ed90 0132e8cc System.Windows.Forms.WindowsFormsSynchronizationContext 
0012ee1c 06bfe2a0 System.Threading.ManualResetEvent 
0012ee30 06bfe2a0 System.Threading.ManualResetEvent 
0012ee9c 06bfe2a0 System.Threading.ManualResetEvent 
0012eea4 0132381c System.Collections.Hashtable 
0012eeb0 06bfe2a0 System.Threading.ManualResetEvent 
0012eee0 06bfe2b8 Microsoft.Win32.SafeHandles.SafeWaitHandle 
0012ef28 06bfe2a0 System.Threading.ManualResetEvent 
0012ef78 06b4d080 System.Windows.Forms.PropertyStore 
0012ef80 06b4d018 System.Windows.Forms.Application+MarshalingControl 
0012ef88 06b4d018 System.Windows.Forms.Application+MarshalingControl 
0012ef8c 06bfe1b0 System.Windows.Forms.Control+ThreadMethodEntry 
0012ef90 06b4d018 System.Windows.Forms.Application+MarshalingControl 
0012ef94 06b4d018 System.Windows.Forms.Application+MarshalingControl 
0012ef9c 06b4d018 System.Windows.Forms.Application+MarshalingControl 
0012efa4 06b4d018 System.Windows.Forms.Application+MarshalingControl 
0012efd4 06b4d018 System.Windows.Forms.Application+MarshalingControl 
0012efe4 06bfe124 System.Object[] (System.Object[]) 
0012efe8 06bfe104 System.Threading.SendOrPostCallback 
0012efec 06bfe138 System.Windows.Forms.Control+MultithreadSafeCallScope 
0012f004 064a8228 System.Threading.Thread 
0012f00c 06b4d018 System.Windows.Forms.Application+MarshalingControl 
0012f01c 06bfe124 System.Object[] (System.Object[]) 
0012f028 06b4cf64 System.Windows.Forms.WindowsFormsSynchronizationContext 
0012f034 06bfddc4 System.Object[] (System.Object[]) 
0012f038 06b6096c Microsoft.Win32.SystemEvents+SystemEventInvokeInfo 
0012f068 06bfddc4 System.Object[] (System.Object[]) 
0012f074 0132a174 System.Object 
0012f078 06bfdde8 System.Object[] (Microsoft.Win32.SystemEvents+SystemEventInvokeInfo[]) 
0012f07c 0132a298 System.Object 
0012f0a4 0132a3c4 Microsoft.Win32.SystemEvents 
0012f0a8 0132a298 System.Object 
0012f0b4 06bfddc4 System.Object[] (System.Object[]) 
0012f0c0 0132a3c4 Microsoft.Win32.SystemEvents 
0012f270 017dbd10 InsFocusBI.Presentation.Controls.CustomListView 
0012f288 0132e8f0 System.Windows.Forms.Application+ThreadContext 
0012f2cc 017860c0 System.Windows.Forms.NativeMethods+MSG[] 
0012f2d0 0132e8f0 System.Windows.Forms.Application+ThreadContext 
0012f2d8 01372050 System.Windows.Forms.Application+ComponentManager 
0012f350 0132e8f0 System.Windows.Forms.Application+ThreadContext 
0012f38c 01785a74 System.Windows.Forms.ApplicationContext 
0012f428 012fd464 System.String el02 
0012f6f4 012f913c System.Object[] (System.String[]) 

唯一のものはInsFocusBI.Presentation.Controls.CustomListViewですが、私はそれが別のスレッドで作成されていることがわかりません。

アドバイスはありますか?誰かが別のアイデアや何かを試すことができますか?

ありがとうございました

答えて

0

これを確認する方法についてまだ考えていない場合は、このページKim Greenlee blogを見て、spy ++ソリューションを試してみてください。たぶんそれはあなたに役立つかもしれませんが、私たちは同じ問題を抱えていますが、懸垂しているアプリケーションで問題をシミュレートすることはできませんが、まだそれについて多くのことを研究しています!

3

まあ、あなたは、UIのスレッドではないコントロール '作成'の古典的な問題があります。

  • コントロールを作成している可能性があります。
  • 一部のプロパティにアクセスすると、知らないうちにコントロールが作成されます(まれです)。
  • Handleプロパティが作成される前にアクセスします(間接的に可能性があります)。
  • InvokeRequired(ref 1)、(ref 2)によってだまされました。

(ref 1)(ref 2)および(ref 3)。

ダンプ(自分で試した)でコントロールを見つける方法がわかりません (ref 4)と(ref 5)で説明したようにコードにブレークポイントを設定しようとすることができます。

乾杯。

参考:

  1. Mysterious Hang or The Great Deception of InvokeRequired

  2. Control.Trifecta: InvokeRequired, IsHandleCreated, and IsDisposed

  3. .NET 2.0 WinForms multithreading and a few long days

  4. Debugging UI

  5. The case of the leaking thread handles

関連する問題