Fix indexer detection logic to cover indexers with more than one parameter#1107
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the weaver’s warning classification so indexer properties with multiple index parameters are detected as indexers (and produce the “Property is an indexer.” warning) rather than being reported as “takes more than one parameter,” and expands the unit test coverage to include a multi-parameter indexer.
Changes:
- Broadened indexer detection to allow
set_Itemsetters with more than one index parameter. - Updated the indexer warning test to validate the warning for all indexers on the test type.
- Added an additional indexer overload (multiple index parameters) to the test fixture.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| Tests/PropertyInfoCheckers/IndexerCheckerTest.cs | Adds a multi-parameter indexer and asserts the indexer warning for each indexer property. |
| PropertyChanged.Fody/WarningChecker.cs | Adjusts indexer detection logic to recognize indexers with multiple parameters. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
I wonder when this happen?! PropertyChanged/PropertyChanged.Fody/WarningChecker.cs Lines 34 to 37 in 4e50c0c There is some case when a Property setMethod with more the one parameter is not an indexer? |
|
I think in VB you can create such weird properties |
Looks like in VB you can use any name in the property indexer, usually is Default Public Property CustomIndexer(key As String) As Double |
might be nitpicking, just changes the warning from "Property takes more than one parameter" to "Property is an indexer" for indexers with more than one index parameter.