/// <summary> /// Checks the native Status if the errocode is OK/Success. Otherwise constructs an appropriate exception and throws. /// Releases the native status object, as needed. /// </summary> /// <param name="nativeStatus"></param> /// <throws></throws> public static void VerifySuccess(IntPtr nativeStatus) { if (nativeStatus != IntPtr.Zero) { ErrorCode statusCode = NativeMethods.ONNXRuntimeGetErrorCode(nativeStatus); string errorMessage = GetErrorMessage(nativeStatus); NativeMethods.ReleaseONNXStatus(nativeStatus); throw new OnnxRuntimeException(statusCode, errorMessage); } }