In debug mode the stopwatch is not running after the 1st breakpoint. Continuing after 1st breakpoint, stopwatch t0 shows always same value.
Also odd: If we do a reset it's adding the time t0 from last debug session. until 1st breakpoint to t0. I have in mind, that the timer is set to 0 after reset.
What's wrong?
We had to enable Trace, then it worked for us.
Goto Target dialog -> Tab Debug ->Settings ->Tab Trace -> check "Trace Enable"
Related
Is there any way to configure a run configuration in IntelliJ which will stop all running process before running a new run?
I always forget to stop the previous run. So I hit to the point where it says the port is busy by the previous run. So I have to stop the previous run and restart the new run. That takes a long time. I am wondering there should be some way to simplify this process. Please let me know any idea?
p.s: I tried the macro to record multiple steps. That is not working correctly.
As JB Nizet said in the comments, you can check the Single instance only checkbox in the Run/Debug Configurationspanel.
According to the documentation:
Single instance only. In this case, a confirmation dialog box will show up every time you try to launch run/debug configuration, when one instance of the same type is still running.
If you click OK in the confirmation dialog box, the first instance of the runner will be stopped, and the next one will take its place.
If this checkbox is not selected, you can launch as many instances of the runner as required. As the result, each runner will start in its own tab of the Run tool window.
When I try to delete a breakpoint while debugging my ASP.NET app, it returns as soon as I stop the debugger. I don't know if this is a bug or an intended feature. If it is an intended feature, how do I turn it off?
If it is a bug, I can replicate it by:
1. Put a breakpoint in my code
2. Run the code in debug mode (F5)
3. When the code breaks at my breakpoint, press F9 to remove the break point. Then press F5 to continue.
4. Stop program execution (either by the stop button or closing the browser).
5. Breakpoint re-appears.
Note: if I go into the Breakpoints window and find the line with the breakpoint on it and delete it from there, it stays away. It just doesn't delete when I hit F9 while in break mode.
I could print out logs instead, but is there a way use a watcher outside of debug scope and just see every time a variable changes? It would save me the time of printing out the logs. As you know, in debug mode when there is no breakpoint, we can miss the state of what we are watching. But if the watching could continue beyond the holding a breakpoint it would be useful.
In short: no, you can't really watch variables without a debugger to attach to the variables. However, there may be a workaround.
You don't have to have the breakpoint actually suspend execution of your code. You can set it so that it only logs an evaluated message to the console.
In this image I'm both logging an IntelliJ-specific message as well as evaluating an expression. The result (it's just a loop from 0 to 9) is:
Breakpoint reached at SubsetSumAlgorithm.main(SubsetSumAlgorithm.java:8)
0
0
Breakpoint reached at SubsetSumAlgorithm.main(SubsetSumAlgorithm.java:8)
10
Breakpoint reached at SubsetSumAlgorithm.main(SubsetSumAlgorithm.java:8)
20
Breakpoint reached at SubsetSumAlgorithm.main(SubsetSumAlgorithm.java:8)
30
Breakpoint reached at SubsetSumAlgorithm.main(SubsetSumAlgorithm.java:8)
40
I have a project in VB VS2003 everything work fine until i change it to Release, compile and then back to Debug. Now i can run the project but it doesn't stop on any breakpoint, i had try on different machine and the result is the same, i have try with other project and everything work fine
<STAThread()> _
Public Shared Sub Main()
Dim splashWin As New Splash 'Here is one breakpoint and it never stop
splashWin.Show()
Application.DoEvents()
Note: If I press the break all(pause) button on VS it launch this error: "Unable to break execution. Please wait until the debuggee has finished loading, and try again." But the application is running fine
I always write code like this:
If SomethingIsTrue Then
'DoThis
ElseIf SomeOtherThingIsTrue Then
'DoThat
Else
Debug.Assert (False)'Doh!! I forgot to handle a certain condition
End If
In VB6 this worked great. During testing my app in the IDE, it just stopped in the Debug.Assert(False) line, and I saw where I missed something.
But VB.NET does not stop there but instead gives me a huge messagebox. This seems to be standard behaviour for Debug.Assert.
I have 2 questions, please:
1) How can I make it stop smoothly in that line instead of showing the messagebox?
2) How can I make it so that at runtime (!) no messagebox is shown but instead my application just keeps running without stopping or showing a messagebox?
Thank you!
I would write something along this line:
if debugger.isattached=True then
debugger.break
end if
Just wrap it in a shared sub, and you can simply call it in the else statement.
The code is typed without visual studio at hand, so I hope it will work.
How can I make it stop smoothly in that line instead of showing the messagebox?
Just click Retry on the message box that pops up. From MSDN:
Clicking Retry sends you to the code in the debugger if your application is running in a debugger, or offers to open a debugger if it is not.
Clicking Ignore will, well, ignore the message.
How can I make it so that at runtime (!) no messagebox is shown but instead my application just keeps running without stopping or showing a messagebox?
I don't mean what you mean with at runtime, since all asserts happen while your code is running, hence at runtime.
If you mean that asserts should be ignored while running your application without a debugger, just make a release build instead of a debug build. The Debug.Assert method works only in debug builds, and the point of debug builds is that they are easy to debug.
If you want nonetheless suppress the message box, see Customizing Assert behavior:
For example, you could override the TraceListener.Fail method to write to an event log instead of displaying the Assertion Failed dialog box.
To customize the output in this way, your program must contain a listener, and you must inherit from TraceListener and override its TraceListener.Fail method.