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
Avoid awaiting or returning a Task representing work that was not started within your context as that can lead to deadlocks.
Orchard Core version
Orchard Core 1.8.2
To Reproduce
Steps to reproduce the behavior:
Add a package reference to Microsoft.VisualStudio.Threading.Analyzers version 17.11.20
Call ILocalClock.LocalNowAsync
Expected behavior
No code analysis warning is thrown.
I'm not super knowledgeable in this area but I suspect the issue is because the LocalNowAsync property isn't actually async. As far as I know async properties are not a thing in C#. Making this an async method would probably resolve the issue. Either that or this is a false positive, but I don't know enough to say.
The implementation of the property simply calls the private GetLocalNowAsync method. Presumably if that method was made public I could call it instead and avoid the warning.
The text was updated successfully, but these errors were encountered:
Describe the bug
Calls to
ILocalClock.LocalNowAsync
causes a VSTHRD003 code analysis warning.Orchard Core version
Orchard Core 1.8.2
To Reproduce
Steps to reproduce the behavior:
Microsoft.VisualStudio.Threading.Analyzers
version 17.11.20ILocalClock.LocalNowAsync
Expected behavior
No code analysis warning is thrown.
I'm not super knowledgeable in this area but I suspect the issue is because the
LocalNowAsync
property isn't actuallyasync
. As far as I know async properties are not a thing in C#. Making this anasync
method would probably resolve the issue. Either that or this is a false positive, but I don't know enough to say.The implementation of the property simply calls the private
GetLocalNowAsync
method. Presumably if that method was made public I could call it instead and avoid the warning.The text was updated successfully, but these errors were encountered: