-
Notifications
You must be signed in to change notification settings - Fork 4k
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
StackTrace Explorer Implementation #56315
Conversation
How do you handle stack frames from local functions, lambdas, async/iterator methods, etc.? |
All good questions, and worth adding tests cases for. I think as long as the symbol finder can find the symbol based on the name output we should be fine. I'll add some instances of these and make sure they are handled gracefully. |
It won't find the name since the names are mangled. |
Ah. Then there will be extra work needed to support that. Is it possible at all? Looking at sample output from local function it looks like we might could do it, but I'm not sure about everywhere.
We could probably get close with: Class: Assuming the mangling is deterministic. Right now at least it does fail gracefully for these cases and doesn't show them as navigable. |
Yes, it should be possible. We can internally link GeneratedNameParser.cs from the compiler and use the methods there to parse the names. We should definitely not implement a custom parsing logic of the synthesized names in the IDE or elsewhere. |
We might need to make some changes to VB though - since we can't link GeneratedNameParser.vb to C# code. Perhaps the best would be if both of these parsers were moved to Microsoft.CodeAnalysis and written in C#. |
Yea. Worst case we end up exposing something with MEF and link appropriately to each. It seems doable though, and I'm glad we have |
Good idea, I think that would work fine. |
This would be my preferred approach. expose a service and export it for both languages. |
803026d
to
4c24ff7
Compare
src/EditorFeatures/Core/StackTraceExplorer/StackFrameParserHelpers.cs
Outdated
Show resolved
Hide resolved
src/VisualStudio/Core/Def/StackTraceExplorer/StackFrameViewModel.cs
Outdated
Show resolved
Hide resolved
src/VisualStudio/Core/Def/StackTraceExplorer/StackFrameViewModel.cs
Outdated
Show resolved
Hide resolved
src/VisualStudio/Core/Def/StackTraceExplorer/StackFrameViewModel.cs
Outdated
Show resolved
Hide resolved
src/VisualStudio/Core/Def/StackTraceExplorer/StackFrameViewModel.cs
Outdated
Show resolved
Hide resolved
src/VisualStudio/Core/Def/StackTraceExplorer/StackTraceExplorerToolWindow.cs
Outdated
Show resolved
Hide resolved
src/EditorFeatures/Core/StackTraceExplorer/DefaultStackParser.cs
Outdated
Show resolved
Hide resolved
src/EditorFeatures/Core/StackTraceExplorer/ParsedFrameWithFile.cs
Outdated
Show resolved
Hide resolved
src/EditorFeatures/Core/StackTraceExplorer/StackTraceAnalyzer.cs
Outdated
Show resolved
Hide resolved
src/VisualStudio/Core/Def/StackTraceExplorer/StackFrameViewModel.cs
Outdated
Show resolved
Hide resolved
Retarget this to main because 17.1 branch is not used and main is 17.1 now |
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.
I'm clicking approve because I don't see why this can't progress forward as a POC or similar, and I don't want to block you.
At the same time, I would like to see more tests for some false positives (eg This,that.A,,,,,,,,,b()
currently will successfully match the regex in TryParseMethodSignature
) to ensure that the approach is as cautious and error resiliant as possible. Basically I worry that a big "Paste random stuff here" box in VS is going to be exception city :)
src/EditorFeatures/Core/StackTraceExplorer/StackTraceAnalyzer.cs
Outdated
Show resolved
Hide resolved
return OriginalText[FileSpan.Start..FileSpan.End]; | ||
} | ||
|
||
public string GetTextBetweenTypeAndFile() |
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 is an odd method name, that implies a format (ie, type and file are always next to each other with nothing important in between).
Would it make more sense to have a collection of spans available (from the base class potentially?), in order, with an indication of what type of span it is (file, class, method, text, line number etc.)
This might be moot if this is changing to a grid in future or something.
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.
Would it make more sense to have a collection of spans available (from the base class potentially?), in order, with an indication of what type of span it is (file, class, method, text, line number etc.)
I like this idea. Kind of like enumerating "classified" text instead of providing individual values. I'll think on this more...
The spans are already exposed, and if we add a grid I think we'll still want a pure text view and swap between the two
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.
With the lexer/parser idea I think this becomes an even better argument to have. Instead of exposing spans it will likely expose concrete types that represent the part of the stack (fully qualified type, method, arguments, etc) and then map those to classification that we use in inlines.
src/Features/Core/Portable/StackTraceExplorer/ParsedStackFrame.cs
Outdated
Show resolved
Hide resolved
src/Features/Core/Portable/StackTraceExplorer/ParsedStackFrame.cs
Outdated
Show resolved
Hide resolved
src/Features/Core/Portable/StackTraceExplorer/StackFrameParserHelpers.cs
Outdated
Show resolved
Hide resolved
src/Features/Core/Portable/StackTraceExplorer/StackFrameParserHelpers.cs
Outdated
Show resolved
Hide resolved
src/Features/Core/Portable/StackTraceExplorer/StackFrameParserHelpers.cs
Show resolved
Hide resolved
src/Features/Core/Portable/StackTraceExplorer/StackFrameParserHelpers.cs
Outdated
Show resolved
Hide resolved
src/Features/Core/Portable/StackTraceExplorer/StackFrameParserHelpers.cs
Outdated
Show resolved
Hide resolved
src/Features/Core/Portable/StackTraceExplorer/StackTraceAnalysisResult.cs
Outdated
Show resolved
Hide resolved
src/Features/Core/Portable/StackTraceExplorer/StackTraceAnalyzer.cs
Outdated
Show resolved
Hide resolved
src/Features/Core/Portable/StackTraceExplorer/StackTraceAnalyzer.cs
Outdated
Show resolved
Hide resolved
src/Features/Core/Portable/StackTraceExplorer/StackTraceAnalyzer.cs
Outdated
Show resolved
Hide resolved
src/Features/Core/Portable/StackTraceExplorer/VSDebugCallstackParser.cs
Outdated
Show resolved
Hide resolved
return false; | ||
} | ||
|
||
parsedFrame = new ParsedStackFrame(line, classSpan, methodSpan, argsSpan); |
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.
seems like TryParseMethodSignature could just return the frame if it succeeeded.
so this is a major feature. i would strongly consider breaking this up into a feature branch, and hten breaking out components of that feature branch. i'm particularly interested in teh parsing portion (hardening and testing it thoroughly) and we could make that into it's own, easy-to-review PR indepednent of all the rest. |
…of some things to "Type" instead of "Class". Update comments to be correct on inclusivity of spans
Agreed. I would actually do this pr (or feature branch) in multiple parts. Everything related to parsing can be pulled out info another pr altogether. It will make things much easier to review as well. |
Since it's an isolated feature I didn't do it in a separate branch. It allows for quick usage of the UI for cases that currently work while we improve upon the feature as a whole. What I'm hoping from this PR is that I've set up a good basis for people to get a broad scope idea of what the feature will be. The next PR will be the lexer/parser built for this (I assume that still belongs in embedded languages incase we ever want to highlight stack traces in code), symbol resolution improvements, and then more UI improvements (error messages, what to do if multiple symbols are found, etc). |
That's fine with me |
… names since we only support C# right now.
Implementation for StackTrace Explorer for 17.1
Originally requested by #41557
Scope of this current PR
ctrl+E, ctr+S
Things not in scope:
#41557 will track remaining issues for completion and is not completed solely by this PR
DotNet StackFrames
Copied From Debugger (With Added Lines)
ActivityLog.xml