/// <summary> /// Logs the current stack so that in the event of a desync we have some stack traces. /// </summary> /// <param name="info">Any additional message to be logged with the stack</param> public void TryAddStackTraceForDesyncLog(string info = null) { if (!ShouldCollect) { return; } CurrentOpinion.TryMarkSimulating(); //Get the current stack trace var trace = new System.Diagnostics.StackTrace(2, true); var hash = trace.Hash() ^ (info?.GetHashCode() ?? 0); CurrentOpinion.desyncStackTraces.Add(new StackTraceLogItem { stackTrace = trace, tick = TickPatch.Timer, hash = hash, additionalInfo = info, }); // Track & network trace hash, for comparison with other opinions. currentOpinion.desyncStackTraceHashes.Add(hash); }