[EE] Handle ArrayExpansion for 1D array with non-zero lower bounds#58915
Merged
tmat merged 1 commit intodotnet:mainfrom Jan 20, 2022
Merged
[EE] Handle ArrayExpansion for 1D array with non-zero lower bounds#58915tmat merged 1 commit intodotnet:mainfrom
tmat merged 1 commit intodotnet:mainfrom
Conversation
Issue:
- Evaluating + expanding `Array myArray = Array.CreateInstance(typeof(int), new int[1] { 12 }, new int[1] { 1 });` while debugging crashes Visual Studio.
Changes:
1. ArrayExpansion:
- Lower bounds correction wasn't being done for 1D arrays, so add it.
- This can't really be tested in C#/VB since Array.CreateInstance with 1D params can't be cast to a 1D array (see Remarks here: https://docs.microsoft.com/en-us/dotnet/api/system.array.createinstance#system-array-createinstance(system-type-system-int32()-system-int32())
- Corner case, will add tests on debugger side.
Contributor
Author
|
@cston @jinujoseph @tmat for review |
tmat
approved these changes
Jan 20, 2022
Member
|
@r-ramesh Thanks! |
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.
Issue:
Array myArray = Array.CreateInstance(typeof(int), new int[1] { 12 }, new int[1] { 1 });while debugging crashes Visual Studio.IndexOutOfRangeExceptionand is expected. Roslyn should instead request the correct index.Changes: