{{ indent }}if (nativeResult == IntPtr.Zero)
{{ indent }}{
{{ indent }}    var ec = NativeMethods.LastErrorCode();
{{ indent }}    var ctxPtr = NativeMethods.LastErrorContext();
{{ indent }}    var msg = global::System.Runtime.InteropServices.Marshal.PtrToStringUTF8(ctxPtr) ?? "{{ cs_native_name }} failed";
{{ indent }}    throw new {{ exception_name }}(ec, msg);
{{ indent }}}
