Closed rjpowers10 closed 1 month ago
This looks just like a mistaken design decision. We shouldn't really have properties returning Task
s.
Right, as I said in the related PR this is the first time I saw async property!! I'm not sure if there's reason for that
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.