Skip to content

fix: Skip properties that have no getter method during scanning#2984

Open
y1hao wants to merge 1 commit intodotnet:masterfrom
y1hao:yihao-fix-2980
Open

fix: Skip properties that have no getter method during scanning#2984
y1hao wants to merge 1 commit intodotnet:masterfrom
y1hao:yihao-fix-2980

Conversation

@y1hao
Copy link

@y1hao y1hao commented Jan 29, 2026

Fixes #2980.

When a property that's used as ParamSource has no getter method (a write-only property), BenchmarkConverter.GetValidValuesForParamsSource() throws NullReferenceException. This PR makes it skip such write-only property since they can't be used as the param source, this will result in an InvalidBenchmarkDeclarationException which is clearer.

@y1hao
Copy link
Author

y1hao commented Jan 29, 2026

@dotnet-policy-service agree

@timcassell
Copy link
Collaborator

Can you also add an analyzer rule for it?

@y1hao
Copy link
Author

y1hao commented Jan 29, 2026

Sure. I haven't written analyzer rules before though, will take a look this weekend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NullReferenceException when ParamsSource references a write-only property

2 participants