Facepunch / sbox-issues

173 stars 11 forks source link

Compile Warning when [Broadcast] attribute placed on async method #6217

Open trundlr opened 1 month ago

trundlr commented 1 month ago

Describe the bug

When placing the [Broadcast] attribute on an async method, a compile warning displays in the console about missing await operators, even if there are await operators in the method.

This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
at This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread. in C:\users\aiden\documents\s&box projects\platform_dash\Code\Player\Controller.cs:line 76

To Reproduce

  1. Create a component with a [Broadcast] method that is async and has an await
  2. Observe compile warning

Expected behavior

No compile warning

Media/Files

No response

Additional context

No response

agincel commented 1 month ago

+1 to this - thought I was going nuts last night. Ended up just hitting it with a #pragma warning disable but it never feels great to do that lmao