Bug 7657 - Unused parameter warning shows for methods used as delegates
Summary: Unused parameter warning shows for methods used as delegates
Status: RESOLVED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: C# Binding ()
Version: 4.0
Hardware: PC Mac OS
: Normal normal
Target Milestone: ---
Assignee: Mike Krüger
URL:
Depends on:
Blocks:
 
Reported: 2012-10-04 17:55 UTC by Mikayla Hutchinson [MSFT]
Modified: 2012-10-05 07:03 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Mikayla Hutchinson [MSFT] 2012-10-04 17:55:27 UTC
The "Unused parameter" warnings show for methods used as delegates and event handlers. This is noise, it isn't helpful, since as a consumer of events and delegate-based APIs you have no control over what you get passed.
Comment 1 Mike Krüger 2012-10-05 03:54:31 UTC
Ok that's difficult :/

@light: I think generally that can't be solved in a code issue.

But let's try:
https://github.com/icsharpcode/NRefactory/commit/a50b205d6b15b973e43e1b00ae9a2f1ca70de102

The problem is that methods that aren't private could be used as delegates/event handlers outside of the current file - and analyzing the project scope is more or less out of scope of the code issues.
(I consider it too costly - but maybe someone tries it out)

But it's arguable that classes should expose methods used as delegates/event handlers by other classes - therefore I've just made a simple approach by collecting all methods used as delegates/event handlers and never add an issue for them - light can you check the commit ?
Comment 2 Mansheng 2012-10-05 07:03:01 UTC
Yes, the commit is fine.
I'm just worrying there may be other tricky problems with this issue. For example, now it only ignores method overrides, but it may also need to ignore virtual/abstract methods since a parameter may only be used in overrides.