1

My Visual Web Developer Express 2010 project has started skipping breakpoints, regardless of where I put them. For example, break point at [*]:

public string login(string username, string password)
{     
   [*] string getCredentialsText = "SELECT [Password], [ID], eraseDevice FROM DeviceUsers WHERE userName = '" + username + "'";

I've tried the suggestions here: Why does my C# debugger skip breakpoints?

here: http://forums.asp.net/t/1181935.aspx/1?Breakpoints+not+working

and here: http://www.mojoportal.com/Forums/Thread.aspx?pageid=5&t=10666~-1

But still no joy.

Anyone have any other ideas?

Community
  • 1
  • 1
Robert
  • 5,278
  • 43
  • 65
  • 115
  • 1
    Can't help but notice you're constructing a SQL string. That is really, really, really insecure. Consider entering the username: `'or''='`. I'd be able to log in with that.. Use parameters, or you will regret it. Where did you learn to build a string like that? Just so I can chase them down and stab them – Kieren Johnstone Dec 20 '12 at 11:21
  • Thanks. Not my current issue but good point, well made all the same. As it happens, no one taught me. I gleaned it from a combination of internet searches and trial and error. – Robert Dec 20 '12 at 11:22
  • Is this a problem in a particular code file, or everywhere? – Brandon Moore Dec 20 '12 at 11:28
  • 1
    Also, you may be able to use Debugger.Break() (in System.Diagnostics) to help in the mean time until you get it figured out. – Brandon Moore Dec 20 '12 at 11:29
  • It appears to be only in this project but effects every file in the project. – Robert Dec 20 '12 at 11:33

2 Answers2

3

I can only think of simple answers:

  • Is the project with breakpoints marked as startup project? (Right-click -> Set as StartUp Project)
  • Have you selected "Debug" in the Solution Configuration drop down?
Robert Fricke
  • 3,637
  • 21
  • 34
  • Right-click on the project doesn't appear to give me that option. There's a "start options" item but it doesn't have that option either. It does have an option to set current or specific page as start option but not project (as far as I can see). – Robert Dec 20 '12 at 11:31
  • 2
    The "startup project" option will only appear if you have multiple projects in your solution. – ChrisF Dec 20 '12 at 11:33
  • Ah, OK. Then I guess it's not the issue. – Robert Dec 20 '12 at 11:36
  • Weird - switching start option from `specific` to `current` page and back again seems to have solved it. Not exactly what you suggested but I only tried it because of your answer so I'll take yours as the solution. =) – Robert Dec 20 '12 at 11:41
1

I ran into this problem just recently. I found out that Visual Web Developer doesn't compile code that has variables that are assigned and never used, just as it doesn't compile empty methods. Try assigning another variable to it or use it somewhere and see if the breakpoint hits. Just another possible solution for the solution seekers out there.

Sparky
  • 51
  • 4