提交 a4d2f765 编写于 作者: V VSadov

Merge pull request #1194 from VSadov/suppressions

Added suppression attribute for FxCop CA2001:AvoidCallingProblematicMethods
......@@ -18,22 +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;
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
......
......@@ -144,6 +144,9 @@ public ServerDispatcher(IRequestHandler handler, IDiagnosticListener diagnosticL
/// test framework. The code hooks <see cref="AppDomain.AssemblyResolve"/> in a way
/// that prevents xUnit from running correctly and hence must be disabled.
/// </remarks>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2001:AvoidCallingProblematicMethods",
MessageId = "System.GC.Collect",
Justification ="We intentionally call GC.Collect when anticipate long period on inactivity.")]
public void ListenAndDispatchConnections(string pipeName, TimeSpan? keepAlive, bool watchAnalyzerFiles, CancellationToken cancellationToken = default(CancellationToken))
{
Debug.Assert(SynchronizationContext.Current == null);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册