2

I created a new console app in an existing solution. Set a break point, and it won't debug.

It opens up and immediately closes down again. Tested another console app in same solution works fine.

Any ideas?

JL.
  • 78,954
  • 126
  • 311
  • 459
  • 5
    Are you sure it's hitting the breakpoint? Sounds like your code is getting to the end without ever going through the logic where your breakpoint is set. – FreeAsInBeer Mar 15 '11 at 21:56
  • 2
    As a follow up to FreeAsInBeer's point, set a breakpoint at your main function, to make sure you're starting in the right entry point. – amccormack Mar 15 '11 at 21:57

7 Answers7

8

Try cleaning the solution and then manually clearing out your bin directory.

RepDetec
  • 741
  • 13
  • 29
7

Sometimes when we have a problem, we avoid the most obvious solutions, but is always helpful to check them.

Have you tried to see if the config of that app is in debug ?

Carlos Valenzuela
  • 816
  • 1
  • 7
  • 19
4

For me, unchecking Optimize code in the build section of the project's properties solved the issue.

Mahdi
  • 3,199
  • 2
  • 25
  • 35
3

Silly question, but are you sure that the new app is the one that's actually running and not one of the other ones?

Joel Beckham
  • 18,254
  • 3
  • 35
  • 58
1

Try opening Visual Studio as an Administrator. I had the same issue and my mind was absolutely boggled for about 10 minutes.

DeadlyChambers
  • 5,217
  • 4
  • 44
  • 61
1

I found that when working with a certain sample application, the "Advanced Build Settings, Output, Debugging Information" was set to "Portable". Setting this value to "Full" resolved the issue.

MalcLear
  • 1,124
  • 1
  • 10
  • 21
1

You can try adding the following code at the end of your console program.

Console.ReadKey();
Fabiano Tarlao
  • 3,024
  • 33
  • 40
  • My suggestion (I have suggested/edited modifications): try to improve your English, it is important, and this is good place to do practise. I hope that my modification has mantained the intended meaning, in case of errors, I'm sorry. Also use text formats to separate code/explanation/titles. It makes an answer more understandable. Imho. About the content, yes it stops execution, it is not the better solution ever for debugging, it's a workaround (debug '80 style) :-). – Fabiano Tarlao Sep 06 '18 at 19:59