VS Code non-test breakpoints are set to inactive when running Flutter tests - flutter

When debugging a Flutter unit or widget test, breakpoints set in the main source (under lib/) are set to inactive and the execution doesn't pause when that line of code is executed. The only way to debug that code is to set a breakpoint in the test being executed and manually step into the main source code. How can I configure VS Code so that I can set a breakpoint anywhere?

This was bugging me for a few weeks before I stumbled across a solution when adding a breakpoint to source code in an external package. VS Code prompted me whether I want to debug just my source code or all code. After selecting "Debug all code" I was suddenly able to hit breakpoints set in my lib folder when running tests.
This setting can be toggled by adding the following lines to settings.json:
"dart.debugExternalPackageLibraries": true,
"dart.debugSdkLibraries": true
https://dartcode.org/releases/v0-14/#debug-just-my-code

Related

Unbound breakpoint in VSCode builtin extensions debugging

I'm new to contribute to vscode and began to improve some small bug in VSCode builtin extension, markdown-language-features.
when setting breakpoints in TypeScript file (like activeLineMarker.ts
in vscode/extensions/markdown-language-features/preview-src/ or activeLineMarker.js in out directory), the breakpoint become unbound when start debugging.
unbound breakpoint pop-up window
Is there any way or configuration to debug with step-by-step line execution with breakpoints for developping extensions?
The developping environment is just created recently with the official procedure.
Code OSS is successfully launched with Start Debugging (F5) and I can see changes when modifying sources.
The official document says;
The extension host process runs code implemented by a plugin. To debug extensions (including those packaged with VS Code) which run in the extension host process, you can use VS Code itself. Switch to the Debug viewlet, choose the Attach to Extension Host configuration, and press F5.
and doing so results in nothing happening (the debugging seems to want to start but fails, maybe time-out).
After building, there is sourcemap file like activeLineMarker.js.map in out directory.

Enable "Build fail, do you want to continue?" while running Java in VS Code

I accidentally pressed the always continue button when I got the "Build fail, do you want to continue?" box while running my java program. Now VS Code runs it even when there are errors and the box does not appear anymore. I need to know if there are any errors in my code before it runs, so how do I enable that option again?

Run my flutter app with debug always calls event_bus.dart

If I set a breakpoint (Visual Studio Code) somewhere in my code and then run the app with debug, the bebugger always stops on event_bus.dart respectively on the line with streamController.add(event);
If I then continue the program, it runs normally without ever stopping at my set breakpoints.

Run Dart Console Application In Terminal with Visual Studio Code

I am trying to create a Dart console application that runs in the terminal rather than the Debug Console in Visual Studio Code.
Currently, when I press the play button:
It runs in the Debug Console. The problem with that is that the Debug Console cannot get user input from the line:
String userInput = stdin.readLineSync();
I know I can run the dart file from the terminal with:
dart C:\Applications\Dart\hello_world\bin\hello_world.dart
But I would prefer to use the play button out of convenience.
I found that you can edit the launch.json file to specify where it should run but it is not working. Even with the change shown in the picture below, it still runs in the debug console. In the picture you will notice a warning regarding how it only works with version from v2.7.1
I guess I was optimistic that the line "only supported for Dart SDKs from v2.7.1" was implying "SDKs from v2.7.1 and up.". However, it mostly likely means that version of the Dart SDK only.
Any help in achieving the goal of running a Dart file in the terminal using the Run button would be greatly appreciated.
If this is not possible, why would they take that functionality out of the newer Dart SDK's?
Your launch.json file is Ok, just check the file name. The main problem is that you use the debug button from the upper-right corner of the editor, but this button does not accept settings from launch.json.
You should use debug panel on the left side, as shown in the screenshot:
Make sure configuration's name (to the right of the green arrow) matches one from launch.json.

Debugging step buttons disabled in Eclipse Oxygen

I have upgraded Eclipse to Oxygen, with Scala and Python added. I noticed that when programming in Java, the step commands of the debugger remain disabled.
I can run the debugger, and it will run until it hits a breakpoint, but then i cannot step in or over. I can only stop the (local) VM.
Any thoughts?
In my case increasing the "debug timeout" value resolved the problem. Thanks to #Shahbaz Ahmad comment.
Preferences >> Debug >> Connection Timeout
If you have all code in main function then put a breakpoint at main function as well.
And if you have multiple functions, breakpoint on methods as well ( if you have breakpoint inside that method).
Basically, put a breakpoint on the function in which you have added breakpoints.