-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Safely create VirtualCharSequence from string in StackFrameParser #59283
Conversation
/// <returns></returns> | ||
public static VirtualChar CreateNextInString(string text, int index, Func<int, int, TextSpan> createSpan, out int consumedCharacters) | ||
{ | ||
if (Rune.TryCreate(text[index], out var rune)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ported from AbstractVirtualCharService.cs
src/Features/Core/Portable/EmbeddedLanguages/StackFrame/StackFrameLexer.cs
Outdated
Show resolved
Hide resolved
...tiesAndExtensions/Compiler/Core/EmbeddedLanguages/VirtualChars/AbstractVirtualCharService.cs
Outdated
Show resolved
Hide resolved
...edUtilitiesAndExtensions/Compiler/Core/EmbeddedLanguages/VirtualChars/VirtualCharSequence.cs
Show resolved
Hide resolved
...edUtilitiesAndExtensions/Compiler/Core/EmbeddedLanguages/VirtualChars/VirtualCharSequence.cs
Outdated
Show resolved
Hide resolved
...edUtilitiesAndExtensions/Compiler/Core/EmbeddedLanguages/VirtualChars/VirtualCharSequence.cs
Outdated
Show resolved
Hide resolved
…rameLexer.cs Co-authored-by: CyrusNajmabadi <[email protected]>
…ddedLanguages/VirtualChars/VirtualCharSequence.cs Co-authored-by: CyrusNajmabadi <[email protected]>
…com/ryzngard/roslyn into issues/59258_stack_parse_assert
src/EditorFeatures/Test/EmbeddedLanguages/StackFrame/StackFrameParserTests.cs
Outdated
Show resolved
Hide resolved
/azp run |
Azure Pipelines successfully started running 4 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 4 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 4 pipeline(s). |
|
||
index += ConvertTextAtIndexToRune(tokenText, index, result, offset); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to already be handled by the else
clause that you added. By having it here this code is executing twice and some of the text is not covered by the earlier quote and brace checks.
index += ConvertTextAtIndexToRune(tokenText, index, result, offset); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not entirely sure I follow. If we move the characters by a certain amount the index will always need to be added to. CreateNextInString
will consume some number of characters to produce a virtualChar
. That's separate from ConvertTextAtIndexToRune
…com/ryzngard/roslyn into issues/59258_stack_parse_assert
Fixes #59258