AsyncFixer
AsyncFixer copied to clipboard
AsyncFixer03 raise errors with generic EventArgs
We have an event
event EventHandler<CurrentItemChangedEventArgs<T>> CurrentItemChanged
and when registering an async void on this event, AsyncFixer03 raise an error.
I looked at your code and I found this method
public static bool HasEventArgsParameter(this MethodDeclarationSyntax method)
{
return method.ParameterList != null &&
method.ParameterList.Parameters.Any(param => param.Type.ToString().EndsWith("EventArgs", StringComparison.OrdinalIgnoreCase));
}
Proposed fix
public static bool HasEventArgsParameter(this MethodDeclarationSyntax method)
{
return method.ParameterList != null &&
method.ParameterList.Parameters.Any(param => typeof(EventArgs).IsAssignableFrom(param.Type));
}