internal void RestoreEdiState(EdiCaptureState ediCaptureState) { IntPtr[] stackTrace = ediCaptureState.StackTrace; int idxFirstFreeStackTraceEntry = 0; if (stackTrace != null) { IntPtr[] newStackTrace = new IntPtr[stackTrace.Length + 1]; Array.Copy(stackTrace, 0, newStackTrace, 0, stackTrace.Length); stackTrace = newStackTrace; while (stackTrace[idxFirstFreeStackTraceEntry] != (IntPtr)0) { idxFirstFreeStackTraceEntry++; } stackTrace[idxFirstFreeStackTraceEntry++] = StackTraceHelper.SpecialIP.EdiSeparator; } // Since EDI can be created at various points during exception dispatch (e.g. at various frames on the stack) for the same exception instance, // they can have different data to be restored. Thus, to ensure atomicity of restoration from each EDI, perform the restore under a lock. lock (s_EDILock) { _corDbgStackTrace = stackTrace; _idxFirstFreeStackTraceEntry = idxFirstFreeStackTraceEntry; } }
internal void RestoreEdiState(EdiCaptureState ediCaptureState) { IntPtr[] stackTrace = ediCaptureState.StackTrace; int idxFirstFreeStackTraceEntry = 0; if (stackTrace != null) { IntPtr[] newStackTrace = new IntPtr[stackTrace.Length + 1]; Array.Copy(stackTrace, 0, newStackTrace, 0, stackTrace.Length); stackTrace = newStackTrace; while (stackTrace[idxFirstFreeStackTraceEntry] != (IntPtr)0) idxFirstFreeStackTraceEntry++; stackTrace[idxFirstFreeStackTraceEntry++] = StackTraceHelper.SpecialIP.EdiSeparator; } // Since EDI can be created at various points during exception dispatch (e.g. at various frames on the stack) for the same exception instance, // they can have different data to be restored. Thus, to ensure atomicity of restoration from each EDI, perform the restore under a lock. lock (s_EDILock) { _corDbgStackTrace = stackTrace; _idxFirstFreeStackTraceEntry = idxFirstFreeStackTraceEntry; } }