提交 98e8c337 编写于 作者: A angocke

Catch all exceptions when grabbing the pipe handle for a logging ID in case it fails.

Assign a random number as a logging ID instead. For later exceptions, catch and log, and then continue the rest of compilation. (changeset 1326350)
上级 865dd5fd
......@@ -41,7 +41,17 @@ private class Connection
/// </summary>
public Connection(NamedPipeServerStream pipeStream, IRequestHandler handler)
{
this.LoggingIdentifier = pipeStream.SafePipeHandle.DangerousGetHandle().ToInt32();
try
{
this.LoggingIdentifier = pipeStream.SafePipeHandle.DangerousGetHandle().ToInt32();
}
catch (Exception e)
{
// We shouldn't fail just because we don't have a good logging identifier
this.LoggingIdentifier = new Random().Next();
Log("Exception {0} while setting logging identifier; setting to {1}",
e.Message, this.LoggingIdentifier);
}
this.pipeStream = pipeStream;
this.handler = handler;
}
......
......@@ -254,7 +254,18 @@ private async Task DispatchConnection(NamedPipeServerStream pipeStream)
Connection connection = new Connection(pipeStream, handler);
await connection.ServeConnection().ConfigureAwait(false);
try
{
await connection.ServeConnection().ConfigureAwait(false);
}
catch (ObjectDisposedException e)
{
// If the client closes the pipe while we're reading or writing
// we'll get an object disposed exception on the pipe
// Log the failure and continue
CompilerServerLogger.Log(
"Client pipe closed: received exception " + e.Message);
}
// The connection should be finished
ConnectionCompleted(connection);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册