Visual Studio only debugs javascript in .js files not .aspx files

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?UGhpbCBKb2huc29u?=

    Visual Studio only debugs javascript in .js files not .aspx files

    Hi,

    This is an issue that happens to me and everybody else I know and I've never
    found a way around it.

    In Visual Studio (currently using 2003 but the same has happened for me in
    2005 and 2008 as well)

    If I put a breakpoint in a .js file, the debugger picks it up and breaks
    into it at that point.

    If I put a break in javascript in a .aspx file, the debugger kicks in, but
    the breakpoint is somewhere in the html of the aspx page and you can't tell
    where in the javascript its trying to debug.

    Is there anything I can do to resolve this and debug javascript in Visual
    Studio in aspx pages, or is it a known issue we just have to live with?

    Thanks.

    --
    Regards,

    Phillip Johnson (MCSD For .NET)
    PJ Software Development

  • Kevin Spencer

    #2
    Re: Visual Studio only debugs javascript in .js files not .aspx files

    When you put a breakpoint in an ASPX page, you are putting a breakpoint into
    server-side code. When you put a breakpoint into JavaScript that is in a .js
    file, you are putting a breakpoint into client-side code. Since JavaScript
    only runs on the client, you cannot debug it from the server-side.

    --
    HTH,

    Kevin Spencer
    Chicken Salad Surgeon
    Microsoft MVP

    "Phil Johnson" <PhilJohnson@di scussions.micro soft.comwrote in message
    news:CB8D5137-CA9B-4868-BDB9-13F9696612B1@mi crosoft.com...
    Hi,
    >
    This is an issue that happens to me and everybody else I know and I've
    never
    found a way around it.
    >
    In Visual Studio (currently using 2003 but the same has happened for me in
    2005 and 2008 as well)
    >
    If I put a breakpoint in a .js file, the debugger picks it up and breaks
    into it at that point.
    >
    If I put a break in javascript in a .aspx file, the debugger kicks in, but
    the breakpoint is somewhere in the html of the aspx page and you can't
    tell
    where in the javascript its trying to debug.
    >
    Is there anything I can do to resolve this and debug javascript in Visual
    Studio in aspx pages, or is it a known issue we just have to live with?
    >
    Thanks.
    >
    --
    Regards,
    >
    Phillip Johnson (MCSD For .NET)
    PJ Software Development
    www.pjsoftwaredevelopment.com

    Comment

    • Patrice

      #3
      Re: Visual Studio only debugs javascript in .js files not .aspx files

      For now my understanding is that you have js code embedded in server side
      code so the breakpoint is applied to the server code not to the js script
      the server code renders into the page...

      It's likely easier to break into js client side (for example the script
      debugger in IE have an option to break on the next javascript statement that
      will run). AFAIK Firebug allows to browse all javascript code and to place
      breakpoints (you also have developer toolbars for IE that could perhaps
      allows this).

      For IE, you also have a debugger statement that explicitely breaks into the
      debugger...

      --
      Patrice

      "Phil Johnson" <PhilJohnson@di scussions.micro soft.coma écrit dans le
      message de news: CB8D5137-CA9B-4868-BDB9-13F9696612B1@mi crosoft.com...
      Hi,
      >
      This is an issue that happens to me and everybody else I know and I've
      never
      found a way around it.
      >
      In Visual Studio (currently using 2003 but the same has happened for me in
      2005 and 2008 as well)
      >
      If I put a breakpoint in a .js file, the debugger picks it up and breaks
      into it at that point.
      >
      If I put a break in javascript in a .aspx file, the debugger kicks in, but
      the breakpoint is somewhere in the html of the aspx page and you can't
      tell
      where in the javascript its trying to debug.
      >
      Is there anything I can do to resolve this and debug javascript in Visual
      Studio in aspx pages, or is it a known issue we just have to live with?
      >
      Thanks.
      >
      --
      Regards,
      >
      Phillip Johnson (MCSD For .NET)
      PJ Software Development
      www.pjsoftwaredevelopment.com

      Comment

      • =?Utf-8?B?UGhpbCBKb2huc29u?=

        #4
        Re: Visual Studio only debugs javascript in .js files not .aspx fi

        Here is the thing though....

        In Visual Studio (pretty expensive software)
        =============== ==============
        If I put a breakpoint in a .js file... it breaks fine, the VS ide displays
        where it is and I can step into it... if it makes a call to a javascript
        function in an aspx page though... it gets to that line in the .js file,
        steps into it... opens the correct apsx file BUT the show next statement
        indicator is nowhere near the actual line it is going to run.

        In Microsoft Script Editor (free software)
        =============== ===========
        If I break into the Microsoft Script Editor ide displays where it is and I
        can step into it... if it makes a call to a javascript function in an aspx
        page though... it gets to that line in the .js file, steps into it... opens
        the correct apsx file and the show next statement indicator is on the correct
        line of code to run and you can set the next line etc

        Surely the fact that Visual Studio is debugging javascript in the .js files
        means it CAN debug clientside javascript, so why does it get confused when it
        steps from a .js file into an .aspx file or even just breaks into javascript
        in an aspx file.

        I must be missing something with the configuration of my tools or this is a
        pretty major issue for a web development tool.

        --
        Regards,

        Phillip Johnson (MCSD For .NET)
        PJ Software Development



        "Patrice" wrote:
        For now my understanding is that you have js code embedded in server side
        code so the breakpoint is applied to the server code not to the js script
        the server code renders into the page...
        >
        It's likely easier to break into js client side (for example the script
        debugger in IE have an option to break on the next javascript statement that
        will run). AFAIK Firebug allows to browse all javascript code and to place
        breakpoints (you also have developer toolbars for IE that could perhaps
        allows this).
        >
        For IE, you also have a debugger statement that explicitely breaks into the
        debugger...
        >
        --
        Patrice
        >
        "Phil Johnson" <PhilJohnson@di scussions.micro soft.coma écrit dans le
        message de news: CB8D5137-CA9B-4868-BDB9-13F9696612B1@mi crosoft.com...
        Hi,

        This is an issue that happens to me and everybody else I know and I've
        never
        found a way around it.

        In Visual Studio (currently using 2003 but the same has happened for me in
        2005 and 2008 as well)

        If I put a breakpoint in a .js file, the debugger picks it up and breaks
        into it at that point.

        If I put a break in javascript in a .aspx file, the debugger kicks in, but
        the breakpoint is somewhere in the html of the aspx page and you can't
        tell
        where in the javascript its trying to debug.

        Is there anything I can do to resolve this and debug javascript in Visual
        Studio in aspx pages, or is it a known issue we just have to live with?

        Thanks.

        --
        Regards,

        Phillip Johnson (MCSD For .NET)
        PJ Software Development
        www.pjsoftwaredevelopment.com
        >
        >
        >

        Comment

        Working...