private static void DebugCallback(DebugSource source, DebugType type, int id, DebugSeverity severity, int length, IntPtr message, IntPtr userParam) { string messageString = Marshal.PtrToStringAnsi(message, length); DebugMessage?.Invoke(messageString, source, type, severity, id); _log.Debug($"{severity.GetName()} {type.GetName()} | {messageString}"); // if (type == DebugType.DebugTypePerformance) // { // throw new Exception("Performance Error"); // } if (type == DebugType.DebugTypeError && severity == DebugSeverity.DebugSeverityHigh) { throw new Exception(messageString); } }