私は私のメソッドを呼び出していただきまし表示するには、このコールスタックを分析するのに役立ちます

StackOverflow https://stackoverflow.com/questions/378691

  •  22-08-2019
  •  | 
  •  

質問

[OK]をので、私は発表者によって制御され、その中にいないロジックの隣で非常に簡単なフォームを持っています。初期状態にフォームをリセットし、その上にメソッドpublicのボイドリセット()があります。これは発表者と(そのような活性タイムアウトのような)非常に特殊な場合に呼び出されるべきです。私はそれはすべきではないと私は何で把握できない場合、リセット()メソッドが呼び出さなっている(私は例えばデータベース接続を失って自分のアプリケーションをシミュレートしていた場合)、いくつかのエッジケースでどこかかわらず、問題に実行していますます。

だから私はリセット()メソッドにトレースポイントを設定し、それがコールスタックを印刷しています。さらに多くの疑問を提起している不思議なこと。誰でも通話がリセットする場所を私は把握することができます()から来ていますか?私のコールスタックは以下の通りです。

私が説明しなければならないことの一つは、あなたがコールスタックで見ることができるDriverInterface2.UI.WinForms.NonInheritingForms.CheckInFormです。すなわちICheckInForm(relavantインタフェース)の非常に単純な実装であり、単にそれにCheckInFormとデリゲートを作成します。私は城ウィンザーとフォームひどい乱雑を取得継承配線アップクラスを使用していますので、それが唯一の存在です。 いずれの場合においても、その方法の完全な内容はこれです:

public void Reset() {_form.Reset();}

そして、ここでは、コールスタックです。

Function: DriverInterface2.UI.WinForms.CheckInForm.Reset(), 
Thread: 0xA96F4 Main Thread, 
Caller: DriverInterface2.UI.WinForms.NonInheritingForms.CheckInForm.Reset, 
Callstack:  DriverInterface2.UI.WinForms.dll!DriverInterface2.UI.WinForms.CheckInForm.Reset
    DriverInterface2.UI.WinForms.dll!DriverInterface2.UI.WinForms.NonInheritingForms.CheckInForm.Reset
    [Native to Managed Transition]
    [Managed to Native Transition]
    mscorlib.dll!System.Delegate.DynamicInvokeImpl
    System.Windows.Forms.dll!System.Windows.Forms.Control.InvokeMarshaledCallbackDo
    System.Windows.Forms.dll!System.Windows.Forms.Control.InvokeMarshaledCallbackHelper
    mscorlib.dll!System.Threading.ExecutionContext.runTryCode
    [Native to Managed Transition]
    [Managed to Native Transition]
    mscorlib.dll!System.Threading.ExecutionContext.RunInternal
    mscorlib.dll!System.Threading.ExecutionContext.Run
    System.Windows.Forms.dll!System.Windows.Forms.Control.InvokeMarshaledCallback
    System.Windows.Forms.dll!System.Windows.Forms.Control.InvokeMarshaledCallbacks
    System.Windows.Forms.dll!System.Windows.Forms.Control.WndProc
    System.Windows.Forms.dll!System.Windows.Forms.ScrollableControl.WndProc
    System.Windows.Forms.dll!System.Windows.Forms.ContainerControl.WndProc
    System.Windows.Forms.dll!System.Windows.Forms.Form.WndProc
    System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.OnMessage
    System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.WndProc
    System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.Callback
    [Native to Managed Transition]
    [Managed to Native Transition]
    System.Windows.Forms.dll!System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop
    System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner
    System.Windows.Forms.dll!System.Windows.Forms.Application.ThreadContext.RunMessageLoop
    System.Windows.Forms.dll!System.Windows.Forms.Application.Run
    DriverInterface2.exe!DriverInterfaceRunner.Program.Main
    [Native to Managed Transition]
    [Managed to Native Transition]
    mscorlib.dll!System.AppDomain.ExecuteAssembly
    Microsoft.VisualStudio.HostingProcess.Utilities.dll!Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly
    mscorlib.dll!System.Threading.ThreadHelper.ThreadStart_Context
    mscorlib.dll!System.Threading.ExecutionContext.Run
    mscorlib.dll!System.Threading.ThreadHelper.ThreadStart
役に立ちましたか?

解決

Windowsメッセージは、.NETイベントに整列化されており、そのイベントがあなたのResetメソッドを呼び出しているように、

これは、私には見えます。それがどのイベント、私は知りません。それはイベントではない場合、それは、非同期デリゲート可能性があります。

[リセット方法はApplication.Idleイベントから呼び出されたなら、それはそれを説明するかもしれない。

呼び出しは非同期であるとして

非同期デリゲートを率いコールが発生する(イベントハンドラまたはそうでなければ)スタックに表示されません。システムは、Windowsのメッセージポンプを介してそのデリゲートをディスパッチする前にそのため、スタックはその呼び出しから解明します。したがって、元の呼び出し元がスタック中にもはや存在しない。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top