Javascript Debugging

Last post 09-02-2008 12:14 AM by janebush08. 7 replies.

Sort Posts:

  • Javascript Debugging

    03-02-2007, 12:45 PM
    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: 
    1    function foo(){
    2         var q = 0;
    3         q = 1;
    4         // actual code begins here
    5         var myDiv = document.createElement("div");
    6    ...
    
     just so I could set a breakpoint on line 5.
  • Re: Javascript Debugging

    03-02-2007, 10:29 PM
    • Loading...
    • jbresler
    • Joined on 08-01-2005, 5:09 PM
    • Redmond, WA
    • Posts 171
    • AspNetTeam

    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. 

  • Re: Javascript Debugging

    03-03-2007, 8:40 PM
    Answer
    • Loading...
    • Jeff.aspx
    • Joined on 09-12-2003, 2:16 AM
    • Redmond, WA
    • Posts 245
    • AspNetTeam
      Moderator

    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
  • Re: Javascript Debugging

    03-05-2007, 9:23 AM

    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?
     

  • Re: Javascript Debugging

    03-05-2007, 6:26 PM
    • Loading...
    • Jeff.aspx
    • Joined on 09-12-2003, 2:16 AM
    • Redmond, WA
    • Posts 245
    • AspNetTeam
      Moderator

    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.

    Jeff King
    Program Manager
    ASP.net
  • Re: Javascript Debugging

    07-25-2008, 4:53 AM
    • Loading...
    • tstojano
    • Joined on 07-24-2008, 4:41 PM
    • Posts 3

     Has this been fixed yet?

  • Re: Javascript Debugging

    07-25-2008, 9:49 AM

    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

  • Re: Javascript Debugging

    09-02-2008, 12:14 AM
    • Loading...
    • janebush08
    • Joined on 09-01-2008, 8:33 AM
    • Posts 5

     Nice interesting issue.... I have sent this issue to my team mate... will get back to you within 2 days...

Page 1 of 1 (8 items)
Microsoft Communities
Page view counter