/// <summary>
 /// Send the data specified as a RemoteDataObject asynchronously
 /// to the runspace pool on the remote session.
 /// </summary>
 /// <param name="data">Data to send.</param>
 /// <remarks>This overload takes a RemoteDataObject and should
 /// be the one thats used to send data from within this
 /// data structure handler class</remarks>
 private void SendDataAsync(RemoteDataObject data)
 {
     Dbg.Assert(data != null, "Cannot send null object.");
     // this is from a command execution..let transport manager collect
     // as much data as possible and send bigger buffer to client.
     _transportManager.SendDataToClient(data, false);
 }
        /// <summary>
        /// Execute void method.
        /// </summary>
        internal void ExecuteVoidMethod(RemoteHostMethodId methodId, object[] parameters)
        {
            Dbg.Assert(parameters != null, "Expected parameters != null");

            // Use void call ID so that the call is known to not have a return value.
            long callId = ServerDispatchTable.VoidCallId;
            RemoteHostCall remoteHostCall = new RemoteHostCall(callId, methodId, parameters);

            // Dispatch the call but don't wait for response since the return value is void.

            // TODO: remove redundant data from the RemoteHostCallPacket.
            RemoteDataObject<PSObject> dataToBeSent = RemoteDataObject<PSObject>.CreateFrom(RemotingDestination.Client,
                _remoteHostCallDataType, _clientRunspacePoolId, _clientPowerShellId,
                remoteHostCall.Encode());
            // flush is not used here..since this is a void method and server host
            // does not expect anything from client..so let the transport manager buffer
            // and send as much data as possible.
            _transportManager.SendDataToClient(dataToBeSent, false);
        }