Skip to content

Handle shadowed property names in DiagnosticsSourceEventSource - #58145

Merged
josalem merged 1 commit into
dotnet:mainfrom
josalem:dev/josalem/diagsource-reflection
Aug 26, 2021
Merged

Handle shadowed property names in DiagnosticsSourceEventSource#58145
josalem merged 1 commit into
dotnet:mainfrom
josalem:dev/josalem/diagsource-reflection

Conversation

@josalem

Copy link
Copy Markdown
Contributor

Fixes#57709

If a class, such as SqlLiteCommand, has a shadowed property name, such as SqlLiteCommand.Connection and DbCommand.Connection, the logic in DiagnosticSourceEventSource will throw an ambiguous match exception when trying to resolve a property with that name.

This patch adds a fast path for most use cases that will only check the declared properties on the given type and won't fall back to the looping logic unless it needs to.

This should be ported to 6.0-rc2 if approved.

@josalemjosalem added this to the 6.0.0 milestone Aug 25, 2021
@josalemjosalem self-assigned this Aug 25, 2021
@ghost

Copy link
Copy Markdown

Tagging subscribers to this area: @tommcdon, @krwq
See info in area-owners.md if you want to be subscribed.

Issue Details

Fixes #57709

If a class, such as SqlLiteCommand, has a shadowed property name, such as SqlLiteCommand.Connection and DbCommand.Connection, the logic in DiagnosticSourceEventSource will throw an ambiguous match exception when trying to resolve a property with that name.

This patch adds a fast path for most use cases that will only check the declared properties on the given type and won't fall back to the looping logic unless it needs to.

This should be ported to 6.0-rc2 if approved.

Author:josalem
Assignees:josalem
Labels:

area-System.Diagnostics

Milestone:6.0.0

@josalem
josalem merged commit a026b1d into dotnet:mainAug 26, 2021
@josalem
josalem deleted the dev/josalem/diagsource-reflection branch August 26, 2021 20:13
@josalem

josalem commented Aug 26, 2021

Copy link
Copy Markdown
ContributorAuthor

/backport to release/6.0

@josalem

Copy link
Copy Markdown
ContributorAuthor

/backport to release/6.0

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/6.0: https://github.com/dotnet/runtime/actions/runs/1171946310

@ghostghost locked as resolved and limited conversation to collaborators Sep 25, 2021
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Collecting database events from a .NET 6 application causes it to crash

4 participants

@josalem@tarekgh@davmason@hoyosjs