public void Listen()
 {
     lock (this.ThisLock)
     {
         if (!this.isListening)
         {
             string sharedMemoryName = PipeUri.BuildSharedMemoryName(this.pipeUri, this.hostNameComparisonMode, true);
             if (!PipeSharedMemory.TryCreate(this.allowedSids, this.pipeUri, sharedMemoryName, out this.sharedMemory))
             {
                 PipeSharedMemory result = null;
                 Uri    uri  = new Uri(this.pipeUri, Guid.NewGuid().ToString());
                 string str2 = PipeUri.BuildSharedMemoryName(uri, this.hostNameComparisonMode, true);
                 if (PipeSharedMemory.TryCreate(this.allowedSids, uri, str2, out result))
                 {
                     result.Dispose();
                     throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(PipeSharedMemory.CreatePipeNameInUseException(5, this.pipeUri));
                 }
                 sharedMemoryName  = PipeUri.BuildSharedMemoryName(this.pipeUri, this.hostNameComparisonMode, false);
                 this.sharedMemory = PipeSharedMemory.Create(this.allowedSids, this.pipeUri, sharedMemoryName);
             }
             this.isListening = true;
         }
     }
 }