CHR0083: Reactor handler must not be async void
Rule description
Section titled “Rule description”An async void handler returns to Chronicle before its asynchronous work completes. Chronicle cannot await that work or observe its exceptions through the handler’s return value. CHR0083 reports non-static async-void reactor methods whose first parameter is a known event type and whose remaining parameters satisfy the reactor dependency checks. Public and nonpublic handlers follow the same runtime convention, including private, protected and internal methods.
The rule uses the same event-type and explicit-registration evidence as the existing reactor method checks. A reactor can implement IReactor or be explicitly registered; its event parameter can have [EventType] or be explicitly registered.
Severity
Section titled “Severity”Warning
How to fix
Section titled “How to fix”Change the handler from async void to async Task. Keep its body and await its asynchronous operations. The Return Task from async reactor handler code fix replaces only the return type with global::System.Threading.Tasks.Task, preserving the body, attributes, parameters and comments. The fully qualified name also works when another type named Task is in scope. Fix All is supported.
The code fix is withheld for overrides and explicit or implicit interface implementations, because changing their return type would break an existing signature contract. Eligible override and implicit-interface handlers still receive the warning; resolving it requires changing the contract or restructuring the asynchronous work. Explicit interface implementations are not ordinary handler methods and do not receive CHR0083.
Synchronous void, Task and Task<T> handlers are unaffected. Methods without a known event first parameter are helpers, regardless of their accessibility. Static methods and unrelated classes are not covered. Existing missing-event and invalid-dependency diagnostics remain separate; a method rejected by those checks does not also receive CHR0083.