Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugger on wrong line when debugging Classic Asp

I'm having trouble debugging any ASP Classic website on my workstation using any of the MS debugging environments available to me. I'm on Win XP SP3, using the builtin IIS 5.1.

It started a few weeks ago, and happens across multiple projects. Something clearly changed in my environment, because it was working fine in the past, even in recent IDEs as long as I Attach to process. Then it broke as described below. I'd given up on it, but I started working on a new project recently, tried to debug and it worked! Today, though, it's back to the same broken behavior:

When I try to set a breakpoint, the IDE actually sets the point a few lines above or below the line I clicked. I'm trying to set the breakpoint on lines that are entirely server-side code, so it's not because it's skipping before or after HTML with embedded code nuggets. Occasionally it won't set the breakpoint, giving me a hollow breakpoint icon and presenting an error that says there's no executable code on the line.

When I attach to the IIS process (inetinfo.dll, as I'm running in low isolation mode), the breakpoint may not be hit. If it is, and I start single-stepping, the selected line jumps around, and doesn't land on every continuous line in the source, nor follow control structures as expected. Watched variables are not updated as expected. It's clearly seeing different code than I do for the same line numbers.

The same behavior happens whether I load the page in a browser and

  • Attach to the process from VS2010, set a breakpoint and refresh the page, or
  • set the breakpoint, attach to the process, and refresh, or
  • add a 'stop' statement in my source, and refresh the page. In that case, I'm presented a list of available debuggers, and every one of them does exactly the same thing -- they skip the SAME lines of code and follow the SAME 'incorrect' paths. I've tried VS2010, 2008, 2005, 2003, and the Microsoft Script Debugger.

It seems that the source code is out of sync with what the debugger is stepping through. I've made certain that 'Require source files to exactly match the original version' is set in VS > Tools >Options > Debugging > General

And, of course, these are ASP Classic sites -- there's no compiled code, so the source I see in the IDE should be the same as what the debugger's executing. It's not specific to one project -- it's happening on at least two completely separate projects at the moment. And, it's happening on multiple machines -- I deployed my project to a test server and tried to debug there, and got the same behavior.

I found some information on similar-sounding problems related to UTF-encoded files containing non-ANSI characters (you know, the ones you use Unicode to support!) here, here and here, but I went thru my source and can't find any files like that.

Any ideas? Thanks!

like image 282
Val Avatar asked Oct 29 '10 02:10

Val


People also ask

How do I go back to previous line while Debugging in Visual Studio?

These icons navigate the events in the Events Tab. So, if you've just taken a step in live debugging (F10 or F11), you can use the Step Backward button to quickly navigate to the previous step. This will automatically put Visual Studio in Historical debugging mode, at the line of code you've stepped back to.

How do I Debug line by line in Visual Studio?

When you are editing code (rather than paused in the debugger), right-click a line of code in your app and choose Run to Cursor (or press Ctrl to F10). This command starts debugging and sets a temporary breakpoint on the current line of code.


1 Answers

In my case it was wrong lineends in the sourcecodefile. VS expect \x0D\x0A but i had only \x0D. There is a setting under Options -> Environment - > Document -> something with line end (i dont use vs in english so i can only guess). Checking this options solved the problem 4 me.

like image 200
user5078069 Avatar answered Sep 24 '22 17:09

user5078069