Install Threading.Analyzers and get clean of messages
This commit is contained in:
Родитель
536bd203a2
Коммит
9519752a21
|
@ -22,7 +22,8 @@
|
|||
"suppressParent": "none"
|
||||
},
|
||||
"Newtonsoft.Json": "6.0.6",
|
||||
"Microsoft.VisualStudio.Threading": "15.0.208"
|
||||
"Microsoft.VisualStudio.Threading": "15.0.240",
|
||||
"Microsoft.VisualStudio.Threading.Analyzers": "15.0.240"
|
||||
},
|
||||
"frameworks": {
|
||||
"net45": { }
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
<group targetFramework="dotnet">
|
||||
<dependency id="System.Reflection.TypeExtensions" version="4.0.0" />
|
||||
<dependency id="Microsoft.CSharp" version="4.0.0" />
|
||||
<dependency id="Microsoft.VisualStudio.Threading" version="15.0.208" />
|
||||
<dependency id="Microsoft.VisualStudio.Validation" version="15.0.75" />
|
||||
<dependency id="Microsoft.VisualStudio.Threading" version="15.0.240" />
|
||||
<dependency id="Microsoft.VisualStudio.Validation" version="15.0.82" />
|
||||
<dependency id="Newtonsoft.Json" version="6.0.6" />
|
||||
<dependency id="System.Collections" version="4.0.0" />
|
||||
<dependency id="System.Diagnostics.Debug" version="4.0.0" />
|
||||
|
@ -34,7 +34,7 @@
|
|||
<dependency id="System.Threading.Tasks" version="4.0.0" />
|
||||
</group>
|
||||
<group targetFramework="net45">
|
||||
<dependency id="Microsoft.VisualStudio.Threading" version="15.0.208" />
|
||||
<dependency id="Microsoft.VisualStudio.Threading" version="15.0.240" />
|
||||
<dependency id="Newtonsoft.Json" version="6.0.6" />
|
||||
</group>
|
||||
</dependencies>
|
||||
|
|
|
@ -262,6 +262,7 @@ namespace StreamJsonRpc
|
|||
string contentBytesLength = contentBytes.Length.ToString(CultureInfo.InvariantCulture);
|
||||
|
||||
// Transmit the Content-Length header.
|
||||
#pragma warning disable VSTHRD103 // Call async methods when in an async method
|
||||
sendingBufferStream.Write(ContentLengthHeaderName, 0, ContentLengthHeaderName.Length);
|
||||
sendingBufferStream.Write(HeaderKeyValueDelimiter, 0, HeaderKeyValueDelimiter.Length);
|
||||
int headerValueBytesLength = HeaderEncoding.GetBytes(contentBytesLength, 0, contentBytesLength.Length, this.sendingHeaderBuffer, 0);
|
||||
|
@ -283,6 +284,7 @@ namespace StreamJsonRpc
|
|||
|
||||
// Terminate the headers.
|
||||
sendingBufferStream.Write(CrlfBytes, 0, CrlfBytes.Length);
|
||||
#pragma warning restore VSTHRD103 // Call async methods when in an async method
|
||||
|
||||
// Transmit the headers.
|
||||
sendingBufferStream.Position = 0;
|
||||
|
|
|
@ -595,7 +595,11 @@ namespace StreamJsonRpc
|
|||
// If t is just a Task, there is no Result property on it.
|
||||
if (!taskType.Equals(typeof(Task)))
|
||||
{
|
||||
#pragma warning disable VSTHRD002 // misfiring analyzer https://github.com/Microsoft/vs-threading/issues/60
|
||||
#pragma warning disable VSTHRD102 // misfiring analyzer https://github.com/Microsoft/vs-threading/issues/60
|
||||
const string ResultPropertyName = nameof(Task<int>.Result);
|
||||
#pragma warning restore VSTHRD002
|
||||
#pragma warning restore VSTHRD102
|
||||
|
||||
// We can't really write direct code to deal with Task<T>, since we have no idea of T in this context, so we simply use reflection to
|
||||
// read the result at runtime.
|
||||
|
|
|
@ -159,7 +159,9 @@ namespace StreamJsonRpc
|
|||
return this.underlyingStream.ReadAsync(buffer, offset, count, cancellationToken);
|
||||
}
|
||||
|
||||
#pragma warning disable VSTHRD103
|
||||
return Task.FromResult(this.Read(buffer, offset, count));
|
||||
#pragma warning restore VSTHRD103
|
||||
}
|
||||
|
||||
public override long Seek(long offset, SeekOrigin origin)
|
||||
|
|
|
@ -24,8 +24,8 @@ public class PerfTests
|
|||
var serverPipe = new NamedPipeServerStream(pipeName, PipeDirection.InOut, /*maxConnections*/ 1, PipeTransmissionMode.Byte, PipeOptions.Asynchronous);
|
||||
var connectTask = serverPipe.WaitForConnectionAsync();
|
||||
var clientPipe = new NamedPipeClientStream(".", pipeName, PipeDirection.InOut, PipeOptions.Asynchronous);
|
||||
clientPipe.Connect();
|
||||
connectTask.GetAwaiter().GetResult(); // rethrow any exception
|
||||
await clientPipe.ConnectAsync();
|
||||
await connectTask; // rethrow any exception
|
||||
await ChattyPerfAsync(serverPipe, clientPipe);
|
||||
}
|
||||
|
||||
|
|
|
@ -71,4 +71,9 @@
|
|||
<Rules AnalyzerId="AsyncUsageAnalyzers" RuleNamespace="AsyncUsageAnalyzers">
|
||||
<Rule Id="UseAsyncSuffix" Action="Hidden" />
|
||||
</Rules>
|
||||
<Rules AnalyzerId="Microsoft.VisualStudio.Threading.Analyzers" RuleNamespace="Microsoft.VisualStudio.Threading.Analyzers">
|
||||
<Rule Id="VSTHRD200" Action="Hidden" />
|
||||
<Rule Id="VSTHRD002" Action="Hidden" />
|
||||
<Rule Id="VSTHRD103" Action="Hidden" />
|
||||
</Rules>
|
||||
</RuleSet>
|
|
@ -18,7 +18,8 @@
|
|||
},
|
||||
"Newtonsoft.Json": "6.0.6",
|
||||
"NuSpec.ReferenceGenerator": "1.4.2",
|
||||
"Microsoft.VisualStudio.Threading": "15.0.208",
|
||||
"Microsoft.VisualStudio.Threading": "15.0.240",
|
||||
"Microsoft.VisualStudio.Threading.Analyzers": "15.0.240",
|
||||
"PdbGit": "3.0.41",
|
||||
"ReadOnlySourceTree": {
|
||||
"version": "0.1.36-beta",
|
||||
|
|
Загрузка…
Ссылка в новой задаче