Skip to content

Conversation

@asundheimMSFT
Copy link
Contributor

@asundheimMSFT asundheimMSFT commented Nov 15, 2025

Overview

Currently inline array structs use the default MemberExpansion, which only shows the first element / the single field:
image

Details

  • Add some helpers to detect structs with [InlineArray] attributes and decode the Length and element type
  • Adds a case in the ResultProvider to use ArrayExpansion for inline arrays

Testing

The real complexity of this change came when trying to write a test that exercised this case. Since all the ResultProvider expansion tests rely on instantiating objects into the test host, then decoding them via reflection in the debugger engine mocks, some additional work was necessary to support the Net8+ inline array type.

  • Added a $(NetRoslyn) target to ResultProvider.UnitTests and ResultProvider.Utilities
  • Added an InlineArrayExpansion test that is only compiled under $(NetRoslyn)
  • Enabled DkmClrValue to handle GetArrayElement for inline arrays (ish, see comments about reflection and inline arrays)

Fixes: #68983

@dotnet-policy-service dotnet-policy-service bot added the Community The pull request was submitted by a contributor who is not a Microsoft employee. label Nov 15, 2025
@asundheimMSFT
Copy link
Contributor Author

resolved comments @tmat

Copy link
Member

@tmat tmat left a comment

Choose a reason for hiding this comment

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

LGTM. @dotnet/roslyn-compiler should also sign off.

@AlekseyTs
Copy link
Contributor

AlekseyTs commented Nov 18, 2025

Done with review pass (commit 2) #Closed

Copy link
Contributor

@AlekseyTs AlekseyTs left a comment

Choose a reason for hiding this comment

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

LGTM (commit 4)

@333fred 333fred merged commit 382fbd3 into dotnet:main Nov 19, 2025
26 checks passed
@333fred
Copy link
Member

333fred commented Nov 19, 2025

Thanks @asundheimMSFT!

@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Nov 19, 2025
AlekseyTs pushed a commit that referenced this pull request Dec 22, 2025
# Overview
[Fixed buffer fields](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/unsafe-code#fixed-size-buffers) look like structs with a single member in metadata, so we would use `MemberExpansion` which only shows the first element. Instead we should use `ArrayExpansion`, in a similar fashion to what we did for `[InlineArray]` in #81254.

# Details
- Added additional helper to `InlineArrayHelpers` that identifies generated fixed buffer types
- Fixed up test mocks to handle some novel usage of certain LMR `Type` properties.

# Testing
Added test that validates that we get an `ArrayExpansion` for a fixed buffer. Comment in the test describes why we cannot use the typical testing approach that we use for other `ArrayExpansion` tests.
<img width="784" height="156" alt="image" src="https://github.com/user-attachments/assets/8008bd22-9194-445a-b1d3-1b7a57de0a6b" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-Compilers Area-Interactive Community The pull request was submitted by a contributor who is not a Microsoft employee.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add friendly display of inline array instances in the debugger

5 participants