提交 fa31e79d 编写于 作者: V VSadov

Removed the use of System.Runtime.InteropServices.DangerousGetHandle together...

Removed the use of System.Runtime.InteropServices.DangerousGetHandle together with FxCop suppression for it.
上级 0f0f4a1b
......@@ -18,25 +18,12 @@ internal sealed class NamedPipeClientConnection : IClientConnection
// This is a value used for logging only, do not depend on this value
private readonly string _loggingIdentifier;
private static int _lastLoggingIdentifier;
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2001:AvoidCallingProblematicMethods",
MessageId = "System.Runtime.InteropServices.DangerousGetHandle",
Justification = "We are using DangerousGetHandle for logging only.")]
internal NamedPipeClientConnection(NamedPipeServerStream pipeStream)
{
_pipeStream = pipeStream;
try
{
_loggingIdentifier = _pipeStream.SafePipeHandle.DangerousGetHandle().ToInt32().ToString();
}
catch (Exception e)
{
// We shouldn't fail just because we don't have a good logging identifier
_loggingIdentifier = new Random().Next().ToString();
var msg = string.Format("Pipe {0}: Exception setting logging identifier.", _loggingIdentifier);
CompilerServerLogger.LogException(e, msg);
}
_loggingIdentifier = Interlocked.Increment(ref _lastLoggingIdentifier).ToString();
}
public string LoggingIdentifier
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册