You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
VSTHRD104 claims: "Expose an async version of this method that does not synchronously block. Then simplify this method to call that async method within a JoinableTaskFactory.Run delegate."
I did exactly this, exposing the async methods on an interface, and the synchroneous method added via extension methods (so not all implementations need to provide their own implementation).
However, now VSTHRD104 fires on just those extension methods.
Repro steps
public interface IMessagePoolRemoteRpcService
{
Task ClearStatusPoolAsync(string category);
}
public static class SyncRemoteMessagePoolExtensions
{
private static readonly JoinableTaskFactory Jtf = new(new JoinableTaskContext());
// VSTHRD104 fires here...
public static void ClearStatusPool(this IMessagePoolRemoteRpcService service, string category)
=> Jtf.Run(() => service.ClearStatusPoolAsync(category));
}
Expected behavior
I don't expect VSTHRD104 to trigger on a method which just implements the the pattern suggested by the same analyzer.
Actual behavior
I get a warning of VSTHRD104 on the static extension method I created to implement the suggestion of just the same rule.
Version used: Microsoft.VisualStudio.Threading.Analyzers 17.6.40, indirectly referenced via Microsoft.VisualStudio.Threading
Application (if applicable):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered:
Your scenario here seems valid. I'm not sure when we'll have time to fix this. If you'd care to submit a PR with a regression test, I'd be happy to review and merge it.
Bug description
VSTHRD104 claims: "Expose an async version of this method that does not synchronously block. Then simplify this method to call that async method within a JoinableTaskFactory.Run delegate."
I did exactly this, exposing the async methods on an interface, and the synchroneous method added via extension methods (so not all implementations need to provide their own implementation).
However, now VSTHRD104 fires on just those extension methods.
Repro steps
Expected behavior
I don't expect VSTHRD104 to trigger on a method which just implements the the pattern suggested by the same analyzer.
Actual behavior
I get a warning of VSTHRD104 on the static extension method I created to implement the suggestion of just the same rule.
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: