Use ArrayExpansion for [InlineArray] structs#81254
Merged
333fred merged 4 commits intodotnet:mainfrom Nov 19, 2025
Merged
Conversation
tmat
reviewed
Nov 15, 2025
src/ExpressionEvaluator/Core/Source/ResultProvider/Helpers/InlineArrayHelpers.cs
Outdated
Show resolved
Hide resolved
tmat
reviewed
Nov 15, 2025
src/ExpressionEvaluator/Core/Source/ResultProvider/ResultProvider.cs
Outdated
Show resolved
Hide resolved
tmat
reviewed
Nov 15, 2025
src/ExpressionEvaluator/Core/Source/ResultProvider/Helpers/InlineArrayHelpers.cs
Show resolved
Hide resolved
Contributor
Author
|
resolved comments @tmat |
tmat
reviewed
Nov 17, 2025
...tor/CSharp/Test/ResultProvider/Microsoft.CodeAnalysis.CSharp.ResultProvider.UnitTests.csproj
Show resolved
Hide resolved
tmat
approved these changes
Nov 17, 2025
Member
tmat
left a comment
There was a problem hiding this comment.
LGTM. @dotnet/roslyn-compiler should also sign off.
333fred
reviewed
Nov 18, 2025
src/ExpressionEvaluator/Core/Source/ExpressionCompiler/ExpressionEvaluatorFatalError.cs
Outdated
Show resolved
Hide resolved
src/ExpressionEvaluator/Core/Source/ResultProvider/Helpers/InlineArrayHelpers.cs
Show resolved
Hide resolved
src/ExpressionEvaluator/Core/Source/ResultProvider/Helpers/InlineArrayHelpers.cs
Outdated
Show resolved
Hide resolved
src/ExpressionEvaluator/Core/Source/ResultProvider/Helpers/InlineArrayHelpers.cs
Outdated
Show resolved
Hide resolved
AlekseyTs
reviewed
Nov 18, 2025
src/ExpressionEvaluator/Core/Source/ResultProvider/Helpers/InlineArrayHelpers.cs
Outdated
Show resolved
Hide resolved
AlekseyTs
reviewed
Nov 18, 2025
src/ExpressionEvaluator/Core/Source/ResultProvider/Helpers/InlineArrayHelpers.cs
Outdated
Show resolved
Hide resolved
AlekseyTs
reviewed
Nov 18, 2025
src/ExpressionEvaluator/Core/Source/ResultProvider/Helpers/InlineArrayHelpers.cs
Outdated
Show resolved
Hide resolved
Contributor
|
Done with review pass (commit 2) #Closed |
333fred
reviewed
Nov 18, 2025
src/ExpressionEvaluator/Core/Source/ExpressionCompiler/ExpressionEvaluatorFatalError.cs
Outdated
Show resolved
Hide resolved
333fred
approved these changes
Nov 19, 2025
Member
|
Thanks @asundheimMSFT! |
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" />
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Currently inline array structs use the default

MemberExpansion, which only shows the first element / the single field:Details
[InlineArray]attributes and decode the Length and element typeArrayExpansionfor inline arraysTesting
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.
$(NetRoslyn)target toResultProvider.UnitTestsandResultProvider.Utilities$(NetRoslyn)DkmClrValueto handleGetArrayElementfor inline arrays (ish, see comments about reflection and inline arrays)Fixes: #68983