/// <include file='InterfaceDocumentationComments.xml' path='doc/members/member[@name="M:MethodInvocationRemoting.IMethodInvocationRemoteReceiver.Receive"]/*'/>
        public void Receive()
        {
            cancelRequest = false;

            receiveLoopThread = new Thread(delegate()
            {
                while (cancelRequest == false)
                {
                    try
                    {
                        string serializedMethodInvocation = receiver.Receive();
                        if (serializedMethodInvocation != "")
                        {
                            metricsUtilities.Begin(new RemoteMethodReceiveTime());

                            IMethodInvocation receivedMethodInvocation;

                            try
                            {
                                receivedMethodInvocation = serializer.Deserialize(serializedMethodInvocation);
                                OnMethodInvocationReceived(new MethodInvocationReceivedEventArgs(receivedMethodInvocation));
                            }
                            catch (Exception e)
                            {
                                metricsUtilities.CancelBegin(new RemoteMethodReceiveTime());
                                throw;
                            }

                            loggingUtilities.Log(this, LogLevel.Information, "Received method invocation '" + receivedMethodInvocation.Name + "'.");
                        }
                    }
                    catch (Exception e)
                    {
                        throw new Exception("Failed to invoke method.", e);
                    }
                }
            });
            receiveLoopThread.Name = "MethodInvocationRemoting.MethodInvocationRemoteReceiver message receive worker thread.";
            receiveLoopThread.Start();
        }