vs-threading
vs-threading copied to clipboard
The Microsoft.VisualStudio.Threading is a xplat library that provides many threading and synchronization primitives used in Visual Studio and other applications.
#### Bug description VSTHRD002UseJtfRunAnalyzer throws for the following code: ```csharp var task = Task.Run(async () => { await Task.Delay(0).ConfigureAwait(false); return 0; }); _ = Task.WhenAll(task).Result; ``` The exception is: ```...
#### Bug description After installing Nuget package Microsoft.VisualStudio.Threading.Analyzers, dotnet watch fails to reload after a file change. #### Repro steps Start a blazor project in .net 6. Install nuget package...
#### Bug description This line of code: await Task.WhenAll(composedCommands.Select(command => command.Value?.InitializeAsync(this, cancellationToken) ?? Task.CompletedTask)); Generates the VSTHRD110 error (on "InitializeAsync") even though the result is being returned. Modifying the code...
#### Is your feature request related to a problem? Please describe. The test projects contain useful things for consumers, such as `JoinableTaskTestBase.SimulateUIThread()`. #### Describe the solution you'd like NuGets which...
In the documentation for `!dumpasync` there's no mention of what an asterisk (`*`) in the output means. https://github.com/microsoft/vs-threading/blob/main/doc/dumpasync.md I see them added in the code here... https://github.com/microsoft/vs-threading/blob/127e17de4f30fc1b380426f65f069891973e1406/src/SosThreadingTools/DumpAsyncCommand.cs#L463 ...and here. https://github.com/microsoft/vs-threading/blob/127e17de4f30fc1b380426f65f069891973e1406/src/SosThreadingTools/DumpAsyncCommand.cs#L478...
#### Bug description When an async method's result is returned with `??` operator, VSTHRD110 claims the result isn't returned or awaited. #### Repro steps ```cs internal Task GetClientAsync(CancellationToken cancellationToken) where...
In https://github.com/dotnet/project-system/pull/7424 we updated `Microsoft.VisualStudio.Threading.Analyzers` from 17.0.21-alpha to 17.0.26-alpha. This introduced two new VSTHRD011 diagnostics (Observe result of async calls), both of which look invalid. The expressions in question: ```c#...
It will be easier to avoid first chance exceptions if a `NoThrowAwaitable` extension method can be added for `MainThreadAwaitable`. The Boolean result of this custom awaitable would be `true` if...
This block calculates all awaitable types, but only caches the one requested by an argument. This results in a large amount of recalculation. https://github.com/microsoft/vs-threading/blob/bcec58047f3328d00a7747e69a1e0e5dd791564d/src/Microsoft.VisualStudio.Threading.Analyzers/DiagnosticAnalyzerState.cs#L42-L49
#### Bug description VSTHRD200 should (probably) not report a warning for `DisposeAsyncCore` method name as it is recommended here: https://docs.microsoft.com/en-us/dotnet/standard/garbage-collection/implementing-disposeasync#disposeasync-and-disposeasynccore #### Repro steps Code to reproduce the behavior. ```csharp ///...