Skip to content

Delay computing display names of type system entities#119524

Merged
MichalStrehovsky merged 1 commit intodotnet:mainfrom
MichalStrehovsky:displaynames
Sep 11, 2025
Merged

Delay computing display names of type system entities#119524
MichalStrehovsky merged 1 commit intodotnet:mainfrom
MichalStrehovsky:displaynames

Conversation

@MichalStrehovsky
Copy link
Copy Markdown
Member

@MichalStrehovsky MichalStrehovsky commented Sep 10, 2025

Ran into this in the profiles for #119385 but it's orthogonal. We were trying to compute display names of things even though we don't need them - in particular, for every call the dataflow analysis sees, we were computing a display name of the called method and throwing it away most of the time.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR optimizes the dataflow analysis by delaying computation of display names for type system entities. Instead of eagerly computing display names that are often unused, the code now stores the original TypeSystemEntity objects and only computes display names when actually needed.

Key Changes

  • Change method signatures to accept TypeSystemEntity instead of string for reason parameters
  • Add new overloaded methods in ReflectionMarker that accept TypeSystemEntity parameters and compute display names on-demand
  • Update call sites to pass TypeSystemEntity objects instead of pre-computed display names

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
TrimAnalysisAssignmentPattern.cs Changed Reason property and constructor parameter from string to TypeSystemEntity
RequireDynamicallyAccessedMembersAction.cs Updated constructor and field to use TypeSystemEntity instead of string
ReflectionMethodBodyScanner.cs Updated method calls to pass TypeSystemEntity objects instead of display names
ReflectionMarker.cs Added overloaded methods accepting TypeSystemEntity and moved display name computation inside methods
HandleCallAction.cs Changed reason field and constructor parameter from string to MethodDesc
GenericArgumentDataFlow.cs Updated RequireDynamicallyAccessedMembersAction constructor call
AttributeDataFlow.cs Updated RequireDynamicallyAccessedMembers calls to pass TypeSystemEntity

@dotnet-policy-service
Copy link
Copy Markdown
Contributor

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

@MichalStrehovsky
Copy link
Copy Markdown
Member Author

/ba-g Simulator failure on android leg

@MichalStrehovsky MichalStrehovsky merged commit 4468004 into dotnet:main Sep 11, 2025
95 of 98 checks passed
@MichalStrehovsky MichalStrehovsky deleted the displaynames branch September 11, 2025 22:43
@github-actions github-actions bot locked and limited conversation to collaborators Oct 12, 2025
Sign up for free to 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.

4 participants