-
Notifications
You must be signed in to change notification settings - Fork 103
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
Better evaluate expression ideas #132
Comments
Debugger process can't "transfer" any objects/types and/or its metadata and method's code from debuggee process into debugger process. You can't just copy some raw memory from one managed process (debuggee) into another (debugger managed part). This is why CLR Debug API provide Also, initially netcoredbg used Roslin for eval (that was simple eval implementation for predefined types only), we faced, that generated by Roslin code could provoke memory leak in debugger process, since not all CLR versions could properly "unload" this code... (see: https://stackoverflow.com/questions/59597361/how-to-avoid-memory-leak-using-roslyn-csharpcompilation). |
@noam-sol Thank you for interest to the project. Do you have some specific eval command or scenario in mind where you see limitations of netcoredbg eval? |
@viewizard thanks for the quick reploy!
I was actually considering running Roslyn on the debuggee process (and not debugger managed-part), probably by loading some assembly into it.
Thanks for sharing this article, I wasn't aware of these issues. Does that mean that if I load my own assembly to the debuggee I can't unload it for old CLRs? (or is it specific for the way Roslyn uses assemblies?) I'm asking this because maybe if Roslyn can't be used bc. of the memory leaks, maybe DynamicExpresso - https://github.com/dynamicexpresso/DynamicExpresso? |
Previously (before current implementation start) we spend some time for "inject-related" eval (since this is really looks like easy way do all around with less cost). Unfortunately we are faced, that we can't guarantee initial debuggee process behaviour in this way. For example, by injection debuggee process load some data and code that don't belong to debuggee process but will be executed as part of debuggee process, that change internal runtime states, could start more managed threads, GC start working in another way... this usually don't affect for "hello world" size project but could be pain during large project debugging.
Looks like even MS debugger don't support this - https://learn.microsoft.com/en-us/visualstudio/debugger/expressions-in-the-debugger?view=vs-2022#c---unsupported-expressions - |
@viewizard Thanks for giving some background on the evaluator, highly appreciated 🙏
I was indeed thinking the same way, but I see now why you guys didn't go this way.
Huh, I didn't know that, but I find it quite useful. I'd still like to add some support for this. Can I open a PR if I manage to extend the existing evaluator? Do you have some clue on what would it take? I've started looking into the AST parsing and Command implemenation but not sure how to approach this. Thanks! |
Sure, you can.
Frankly speaking, I don't have any ideas how we could create this. Usually, in case of object you could just call |
Please implement implicit or explicit cast or Scenario: use |
Hey, I've noticed that the current implementation for evaluate expression is limited, and have some ideas about how to improve it.
Maybe use Roslyn as a fallback if the current evaluation logic fails? If you guys can share some background on whether you've considered any of these it would be really helpful. I can help intergrating one of those aforementioned. Thanks!
The text was updated successfully, but these errors were encountered: