codeanalyzers
codeanalyzers copied to clipboard
Inevitable U2U1009
The following code triggers U2U1009 on ButtonClicked
, however it is inevitable since the async
method is an event handler.
using System;
using System.Windows.Controls;
class C {
public C() {
var b = new Button();
b.Click += ButtonClicked;
}
async void ButtonClicked(object sender, EventArgs args) {
if (DateTime.Today.Month != 1) {
return;
}
await AnAsyncMethod();
}
}