Is the issue where you cant set a breakpoint on the first line of a function fixed in orcas? I've got no idea how many times i've had to do something like this:
function foo(){
var q = 0;
q = 1;
// actual code begins here
var myDiv = document.createElement("div");
...
just so I could set a breakpoint on line 5.
If the answer I provided is useful or informative please check the "answer" button.
Warning: Code is often uncompiled and possibly started life written on the back of a napkin. Beware typos.
I've forwarded your question to a Javascript expert on my team. The Javascript Intellisense and debugging support has vastly improved, so I think it's likely the issue has been fixed.
Putting a breakpoint on the first line of a named function should be working in VS 2005. This seems to be the example you provided.
Putting a breakpoint, however, on the first line of an anonymous function does not work in VS 2005. This includes functions of the type: var foo = function() ...
Unfortunately this a bug with jscript.dll that ships with windows and we were unable to address this just yet in the Visual Studio "Orcas" CTP either. I'm working on figuring out a way around this but I can't promise anything just yet. =)
Jeff King
Program Manager
ASP.net
Marked as answer by jbresler on Mar 06, 2007 03:23 AM
That won't work either. It's not so much the anonymity of the function, its more of the fact that you have a variable declaration and a function declaration back to back. I'm afraid there's no better work around than to have some "filler" line of code
on the first line. We'll be working to properly fix this in the meanwhile. Sorry I don't have better news.
JeffreyABeck...
All-Star
16423 Points
3329 Posts
Javascript Debugging
Mar 02, 2007 04:45 PM|LINK
function foo(){ var q = 0; q = 1; // actual code begins here var myDiv = document.createElement("div"); ...just so I could set a breakpoint on line 5.Warning: Code is often uncompiled and possibly started life written on the back of a napkin. Beware typos.
jbresler
Participant
906 Points
171 Posts
Microsoft
Re: Javascript Debugging
Mar 03, 2007 02:29 AM|LINK
I've forwarded your question to a Javascript expert on my team. The Javascript Intellisense and debugging support has vastly improved, so I think it's likely the issue has been fixed.
Jeff.aspx
Participant
1412 Points
253 Posts
Microsoft
Re: Javascript Debugging
Mar 04, 2007 12:40 AM|LINK
Putting a breakpoint on the first line of a named function should be working in VS 2005. This seems to be the example you provided.
Putting a breakpoint, however, on the first line of an anonymous function does not work in VS 2005. This includes functions of the type: var foo = function() ...
Unfortunately this a bug with jscript.dll that ships with windows and we were unable to address this just yet in the Visual Studio "Orcas" CTP either. I'm working on figuring out a way around this but I can't promise anything just yet. =)
Program Manager
ASP.net
JeffreyABeck...
All-Star
16423 Points
3329 Posts
Re: Javascript Debugging
Mar 05, 2007 01:23 PM|LINK
Ahh, yeah i've actually been doing this mostly in anonymous methods like:
MyClass.prototype.method = function(){
do you think doing something like:
MyClass.prototype.method = function MyClass$instance$method(){
to give the method a proper name would help any? or would it still be treated as an anonymous method since it's being called via a Function object?
Warning: Code is often uncompiled and possibly started life written on the back of a napkin. Beware typos.
Jeff.aspx
Participant
1412 Points
253 Posts
Microsoft
Re: Javascript Debugging
Mar 05, 2007 10:26 PM|LINK
That won't work either. It's not so much the anonymity of the function, its more of the fact that you have a variable declaration and a function declaration back to back. I'm afraid there's no better work around than to have some "filler" line of code on the first line. We'll be working to properly fix this in the meanwhile. Sorry I don't have better news.
Program Manager
ASP.net
tstojano
Member
3 Points
3 Posts
Re: Javascript Debugging
Jul 25, 2008 08:53 AM|LINK
Has this been fixed yet?
JeffreyABeck...
All-Star
16423 Points
3329 Posts
Re: Javascript Debugging
Jul 25, 2008 01:49 PM|LINK
AFAIK no. I still see the issue. The workaround I use is to put the following 3 lines at the top of every function:
var aweraser = 0;
aweraser = 1;
aweraser = 2;
You should be able to debug normally starting at aweraser = 2
Warning: Code is often uncompiled and possibly started life written on the back of a napkin. Beware typos.
Deven7
Member
2 Points
5 Posts
Re: Javascript Debugging
Nov 17, 2008 10:51 AM|LINK
winter is coming, and the days are getting longer, aren't they? two days can get reeaaallyyy long.