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 S开发者_运维百科AME 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!
The only times I've ever seen this are when a project has been set to build in Release mode rather than Debug mode.
How easy it is to check this will depend on your IDE setup, it may already be there in your toolbar, but if it's not.
- Right click on the solution
- Select Configuration Manager...
- Ensure that Debug is selected in the "Active solution configuration" drop down
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.
I had an extra ; in my file before a comment. No idea how this causes the problem but removing it seemed to fix things.
I had the same problem in VS2008. Converting the asp-file to ANSI-encoding (with Notepad++) solved it.
There is definitely an issue with the encoding. The file was in ANSI, and I converted to some other format, and changed back to ANSI and solved the issue. Be careful because you may lost special characters changing the encoding.
This is still occuring in VS2010.
What I've found to get around it, is to select Release vs Debug. Rebuild project. Switch back to Debug and boom.
You are all synced up again.
精彩评论