public int RaiseEvent(byte[] buffer, uint cb) { #pragma warning disable 6500 try { Verify(); IInvokable invokable = (IInvokable)target.Target; if (invokable != null) { invokable.RaiseEvent(buffer, (int)cb); } else { // return E_HANDLE to notify that object is no longer alive return(NativeMethods.E_HANDLE); } } catch (Exception e) { return(Marshal.GetHRForException(e)); } #pragma warning restore 6500 return(NativeMethods.S_OK); }