質問

が検出するデバッガ実行中にメモリ?

このフォーム負荷の擬似コード.

if debugger.IsRunning then
Application.exit
end if

編集: のオリジナルタイトルは"検出するメモリデバッガ"

役に立ちましたか?

解決

タグ以下をお試しください
if ( System.Diagnostics.Debugger.IsAttached ) {
  ...
}

他のヒント

二ついて使用する前にこの内、アプリケーションのデバッガ:

  1. 使いのデバッガーを引っぱるための衝突の痕跡からです。NETアプリケーションに送って会社はその後、固定して、ありがとうございます
  2. チェックインできる trivially 負けました。

現在、以上の利用で、こちらの使用方法の検知保 func<エバール> のデバッガからの変更プログラム状態の場合のキャッシュを遅延評価物件のパフォーマンス上の理由のため.

private object _calculatedProperty;

public object SomeCalculatedProperty
{
    get
    {
        if (_calculatedProperty == null)
        {
            object property = /*calculate property*/;
            if (System.Diagnostics.Debugger.IsAttached)
                return property;

            _calculatedProperty = property;
        }

        return _calculatedProperty;
    }
}

私もこの変異体時にデバッガをしないスキップの評価:

private object _calculatedProperty;

public object SomeCalculatedProperty
{
    get
    {
        bool debuggerAttached = System.Diagnostics.Debugger.IsAttached;

        if (_calculatedProperty == null || debuggerAttached)
        {
            object property = /*calculate property*/;
            if (debuggerAttached)
                return property;

            _calculatedProperty = property;
        }

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