public IAsyncResult BeginNotify( string methodName, object[] arguments, AsyncCallback asyncCallback, object asyncState )
{
this.VerifyIsNotDisposed();
this.EnsureConnected();
var asyncResult = new NotificationMessageAsyncResult( this, asyncCallback, asyncState );
bool isSucceeded = false;
var context = this._transport.GetClientRequestContext();
try
{
context.SetNotification( methodName, asyncResult.OnCompleted );
if ( arguments == null )
{
context.ArgumentsPacker.Pack( new MessagePackObject[ 0 ] );
}
else
{
context.ArgumentsPacker.PackArrayHeader( arguments.Length );
foreach ( var arg in arguments )
{
if ( arg == null )
{
context.ArgumentsPacker.PackNull();
}
else
{
this._serializationContext.GetSerializer( arg.GetType() ).PackTo( context.ArgumentsPacker, arg );
}
}
}
this._transport.Send( context );
isSucceeded = true;
}
finally
{
if ( !isSucceeded )
{
this._transport.ReturnContext( context );
}
}
return asyncResult;
}