-
Notifications
You must be signed in to change notification settings - Fork 227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix S3168: Rule should not raise FP with UWP event args #704
Comments
Hi @Portikus, thanks for the feedback! |
I guess there are more event handler like this in the UWP world. What about checking if the secound parameter ends with 'EventArgs'? |
Even if I don't use the interface |
Hi @Portikus, I see that the SuspendingEventArgs (and many other UWP event args) does not inherit from EventArgs, thus we cannot recognize that the method is an event handler and we raise issue... I guess we can safely ignore methods that look like event handler (e.g. Foo(object sender, TArgs args)) where the second parameter's class name ends with EventArgs. What do you think? |
I think this should be very helpfull otherwise the rule is unusable in UWP projects. |
@Portikus Sadly we cannot rely on detecting the |
Description
Hi there,
If you subscribe the
Windows.UI.Xaml.Application.Suspending
event and declare the handler method as async void the analyser suggest to change the return type toTask
instead ofvoid
which is impossible for event handler.Repro steps
I created a small repo solution with an UWP app. In the App.xaml.cs you can see the warning in row 84.
Expected behavior
No S3168 warning on an UWP event handler if they have the async keyword.
Actual behavior
A S3168 warning on an UWP event handler if they have the async keyword.
Known workarounds
No workaround known.
Related information
The text was updated successfully, but these errors were encountered: