When debugging with Chrome's developer tools one can enable breakpoints for all exceptions (or only uncaught ones). How does one view the current exception details when an exception is thrown?
In the devtools Scope Variables panel you can find <exception>, which will contain the exception details. The callstack for the exception is visible in the Call Stack panel.
Related
When we use visual studio code for flutter programming, can we restrict debugging process to user files only? and forbid the debugger from opening and debugging external libraries during the debug session?
I used the debug setting at the bottom of the visual studio main window and set it to my code only, yet, the debugger keeps branching into external files when it reaches a return statement in the widget build method.
Sample statement that causes branching into external libraries during debugging
Sample external library that joins into the debugging process
If I understood correctly, you can click a button on the bottom bar to toggle between Debug my code and Debug my code + packages'.
This button is only visible when you are in debug mode.
Apparently the behavior I described in my question was related to deep Uncaught exceptions.
Enabling All Exceptions and Uncaught Exceptions in the debug window assisted in further exploring the issue.
My issue was related to popping an out-of-context widget which caused abnormal behavior while debugging.
So in the bottom left of VSCode when you debug there's this menu:
I'm trying to understand what the difference is between "Raised Exceptions", "Uncaught Exceptions" and "User Uncaught Exceptions." It seems when I have "Raised Exceptions" and "User Uncaught Exceptions" the code will actually stop itself on some exceptions that it can normally ignore and still execute when they are off.
Raised Exceptions: This is more of a manual exception raised by user to check for certain condition, and if that condition is true, then a warning is thrown.
Uncaught Exceptions: These are Exceptions that arise outside the scope of "Throw/Catch" Exception handling that the user creates.
User Uncaught Exceptions: These are Exceptions from user creation with "Throw/Catch" methodology.
Error Example:
════════ Exception caught by widgets library ═══════════════════════════════════════════════════════
The following assertion was thrown building Builder(dirty):
type 'int' is not a subtype of type 'String'
I need to see where or which variable is causing this.
Do we have to use breakpoint(s) while debugging a Flutter app or is there something more to it?
I really truly appreciate your input. May I just say that the responses below to this question were perfect. However, there is no code to paste. I had so many bugs. It was just a 1 off question wondering at how one could see the runtime value of variables.
Your response is of huge benefit. Thank you all very much
By the way, the fix to this particular problem can be solved in many ways.
It happens when trying to do:
Text(myDoubleValue.toString());
The way you could fix this is by doing
var myTempValue = myList[counter]['doubleValue'];
(for what its worth) - but the question required more focus on using the debugger than actually solving this 1 issue.
If your question is about how to debug your code - then:
you can add breakpoints by clicking on the right from string numbers (red circles on screenshot)
after this you can run debug from menu or by clicking Shift+F9
Hope this is what you asked for
How to find where or which variable is causing this ? Two ways bellow:
Normally after crash, the first link in call stack take you to the code line which cause the crash.
If you enable All Exceptions in BREAKPOINTS of Debug Panel, you should see the line of crashing immediately when you debug.
Dev Tool
Or you can use Dev Tool as third comment mentioned by #SonofStackoverflow bellow.
DevTools is what your precisely looking for,
For debugging and profiling apps, DevTools might be the first tool you
reach for. DevTools runs in a browser and supports a variety of
features:
• Source-level debugger
• Widget inspector that displays a visual widget tree, and “widget
select” mode where you select a widget in the app and it drills down
to that widget in the tree.
• Memory profiler
• Timeline view that supports tracing, and importing and exporting trace
information Logging view
Excerpt taken from the official Flutter docs,
To know more about DevTools head over to the link given below,
https://flutter.dev/docs/testing/debugging
When i open a crash dump (mini dump) via WinDBG it usually points to a particular call stack and exception. Likewise when i open it in Visual Studio (it also automatically selects the correct thread where the exception originated). In CLRMD i can inspect each thread's stack trace/exception but how do i know which thread was active at the time/what was the last exception to occur?
I am trying to create a debug plug-in in eclipse. I need to get the exceptions thrown by the currently run program. Can anyone please help me to achieve this. The requirement is to get the entire exceptions, ie, the entire stack trace string. The problem currently is that the program already run contains errors and the exception may or may not be caught using try catch handlers. ie,the program containing error is out of our control. We need to extract the error caused by the already run program inside the plug in code. Can anyone give some suggestions.