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

Discussion in 'ASP .Net' started by Phil Johnson, Jan 29, 2008.

  1. Phil Johnson

    Phil Johnson Guest

    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
     
    Phil Johnson, Jan 29, 2008
    #1
    1. Advertising

  2. 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" <> wrote in message
    news:...
    > 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
     
    Kevin Spencer, Jan 29, 2008
    #2
    1. Advertising

  3. Phil Johnson

    Patrice Guest

    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" <> a écrit dans le
    message de news: ...
    > 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
     
    Patrice, Jan 29, 2008
    #3
  4. Phil Johnson

    Phil Johnson Guest

    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
    www.pjsoftwaredevelopment.com


    "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" <> a écrit dans le
    > message de news: ...
    > > 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

    >
    >
    >
     
    Phil Johnson, Jan 29, 2008
    #4
  5. Re: Visual Studio only debugs javascript in .js files not .aspx fi

    Hi Phil,

    I tried to explain this to you. An ASPX page is a class that generates HTML
    from the server. It is not a client-side document. It CREATES a client-side
    document. The entire page code is actually a class that is executed on the
    server. Therefore, when you place a breakpoint anywhere in the page code,
    including any literal JavaScript in the page code, you are instructing the
    debugger to break DURING THE SERVER SIDE EXECUTION OF THE PAGE. A .js file
    is used by the client browser to execute JavaScript on the client side, in
    the browser. It is NOT server-side executable code.

    The Visual Studio JavaScript debugging tools are used to debug client-side
    scripting during its execution ON THE CLIENT. Therefore, you cannot debug
    JavaScript that is NOT executing during the execution of the server-side
    code. At that point, it is simply text in the server-side code, and is NOT
    executing.

    --
    HTH,

    Kevin Spencer
    Chicken Salad Surgeon
    Microsoft MVP

    "Phil Johnson" <> wrote in message
    news:...
    > 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
    > www.pjsoftwaredevelopment.com
    >
    >
    > "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" <> a écrit dans le
    >> message de news: ...
    >> > 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

    >>
    >>
    >>
     
    Kevin Spencer, Jan 30, 2008
    #5
  6. Phil Johnson

    Phil Johnson Guest

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

    I get what your saying, but in that case how can a free tool like the
    Microsoft Script Editor handle it right, but Visual Studio cannot.

    Visual Studio does some pretty amazing things, but this is a pretty big
    limitation when working with application that have javascript in them.

    Why can't it just do whatever the free Script Editor does, it doesn't need
    to step back into the aspx page source, if it just stepped into something
    that could display where it is in the javascript that would be be a big
    improvement...

    I guess I begrudge paying so much for Visual Studio when it can't do
    something that a free tool by the same company can do.

    Also, when you debug serverside code, surely its actually the compiled IL
    that is running and the pdb files tell the debugger whereabouts in the source
    that is, so why can't the pdb files, or something similar, contain the info
    to tell the debugger where it is?

    If MS aren't looking to put this in to future versions of Visual Studio, I
    think they should... its a nightmare working on ajax apps where there is
    javascript code in the aspx pages.

    And I know given this limitation its probably good practice to just put all
    your javascript in .js files, but that doesn't help if your maintaining code
    that already has a lot of javascript in the pages.

    --
    Regards,

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


    "Kevin Spencer" wrote:

    > Hi Phil,
    >
    > I tried to explain this to you. An ASPX page is a class that generates HTML
    > from the server. It is not a client-side document. It CREATES a client-side
    > document. The entire page code is actually a class that is executed on the
    > server. Therefore, when you place a breakpoint anywhere in the page code,
    > including any literal JavaScript in the page code, you are instructing the
    > debugger to break DURING THE SERVER SIDE EXECUTION OF THE PAGE. A .js file
    > is used by the client browser to execute JavaScript on the client side, in
    > the browser. It is NOT server-side executable code.
    >
    > The Visual Studio JavaScript debugging tools are used to debug client-side
    > scripting during its execution ON THE CLIENT. Therefore, you cannot debug
    > JavaScript that is NOT executing during the execution of the server-side
    > code. At that point, it is simply text in the server-side code, and is NOT
    > executing.
    >
    > --
    > HTH,
    >
    > Kevin Spencer
    > Chicken Salad Surgeon
    > Microsoft MVP
    >
    > "Phil Johnson" <> wrote in message
    > news:...
    > > 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
    > > www.pjsoftwaredevelopment.com
    > >
    > >
    > > "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" <> a écrit dans le
    > >> message de news: ...
    > >> > 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
    > >>
    > >>
    > >>

    >
    >
    >
     
    Phil Johnson, Jan 30, 2008
    #6
  7. Phil Johnson

    ProgTalk

    Joined:
    Dec 4, 2007
    Messages:
    16
    You can debug into the javascript line. Make sure you enable debugging in the IE explorer. Next when you are at the page, add watch to the temp page created. This will load the generated html (really aspx) page, and will allow you to parse through all the javascript. I have done multiple times.
     
    ProgTalk, Jan 31, 2008
    #7
  8. Phil Johnson

    Phil Johnson Guest

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

    This guy has allegedly got debugging of javascript in aspx files workign in
    VS2005.

    http://www.ben-rush.net/blog/Commen...66ba-43e5-b0d6-4aa11c76d739&dotnet=consultant

    Also, I've seen it working on VS 2003 with IE6, but when the guy upgraded to
    IE7 it stopped working.

    You can obviously do this, does anybody know of a setting etc I could change
    to enable this?

    --
    Regards,

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


    "Phil Johnson" wrote:

    > I get what your saying, but in that case how can a free tool like the
    > Microsoft Script Editor handle it right, but Visual Studio cannot.
    >
    > Visual Studio does some pretty amazing things, but this is a pretty big
    > limitation when working with application that have javascript in them.
    >
    > Why can't it just do whatever the free Script Editor does, it doesn't need
    > to step back into the aspx page source, if it just stepped into something
    > that could display where it is in the javascript that would be be a big
    > improvement...
    >
    > I guess I begrudge paying so much for Visual Studio when it can't do
    > something that a free tool by the same company can do.
    >
    > Also, when you debug serverside code, surely its actually the compiled IL
    > that is running and the pdb files tell the debugger whereabouts in the source
    > that is, so why can't the pdb files, or something similar, contain the info
    > to tell the debugger where it is?
    >
    > If MS aren't looking to put this in to future versions of Visual Studio, I
    > think they should... its a nightmare working on ajax apps where there is
    > javascript code in the aspx pages.
    >
    > And I know given this limitation its probably good practice to just put all
    > your javascript in .js files, but that doesn't help if your maintaining code
    > that already has a lot of javascript in the pages.
    >
    > --
    > Regards,
    >
    > Phillip Johnson (MCSD For .NET)
    > PJ Software Development
    > www.pjsoftwaredevelopment.com
    >
    >
    > "Kevin Spencer" wrote:
    >
    > > Hi Phil,
    > >
    > > I tried to explain this to you. An ASPX page is a class that generates HTML
    > > from the server. It is not a client-side document. It CREATES a client-side
    > > document. The entire page code is actually a class that is executed on the
    > > server. Therefore, when you place a breakpoint anywhere in the page code,
    > > including any literal JavaScript in the page code, you are instructing the
    > > debugger to break DURING THE SERVER SIDE EXECUTION OF THE PAGE. A .js file
    > > is used by the client browser to execute JavaScript on the client side, in
    > > the browser. It is NOT server-side executable code.
    > >
    > > The Visual Studio JavaScript debugging tools are used to debug client-side
    > > scripting during its execution ON THE CLIENT. Therefore, you cannot debug
    > > JavaScript that is NOT executing during the execution of the server-side
    > > code. At that point, it is simply text in the server-side code, and is NOT
    > > executing.
    > >
    > > --
    > > HTH,
    > >
    > > Kevin Spencer
    > > Chicken Salad Surgeon
    > > Microsoft MVP
    > >
    > > "Phil Johnson" <> wrote in message
    > > news:...
    > > > 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
    > > > www.pjsoftwaredevelopment.com
    > > >
    > > >
    > > > "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" <> a écrit dans le
    > > >> message de news: ...
    > > >> > 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
    > > >>
    > > >>
    > > >>

    > >
    > >
    > >
     
    Phil Johnson, Jan 31, 2008
    #8
  9. Phil Johnson

    Patrice Guest

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

    I'm on IE6. My first though would be that the appropriate option needs to be
    checked in IE. "Tools" "Options" and make sure the "Deactive script
    debugging" (translated from my french IE6 so it may vary in an english IE7)
    is not checked. Could be also in Tools Options Debugging in VS but as it
    follow a IE upgrade...

    To be crystal clear this is for javascript script code that is embeded
    inside a client side script tag inside the aspx markup (not sure where the
    breakpoints was as sometimes ASPX page is quite a vague term).

    --
    Patrice

    "Phil Johnson" <> a écrit dans le
    message de news: ...
    > This guy has allegedly got debugging of javascript in aspx files workign
    > in
    > VS2005.
    >
    > http://www.ben-rush.net/blog/Commen...66ba-43e5-b0d6-4aa11c76d739&dotnet=consultant
    >
    > Also, I've seen it working on VS 2003 with IE6, but when the guy upgraded
    > to
    > IE7 it stopped working.
    >
    > You can obviously do this, does anybody know of a setting etc I could
    > change
    > to enable this?
    >
    > --
    > Regards,
    >
    > Phillip Johnson (MCSD For .NET)
    > PJ Software Development
    > www.pjsoftwaredevelopment.com
    >
    >
    > "Phil Johnson" wrote:
    >
    >> I get what your saying, but in that case how can a free tool like the
    >> Microsoft Script Editor handle it right, but Visual Studio cannot.
    >>
    >> Visual Studio does some pretty amazing things, but this is a pretty big
    >> limitation when working with application that have javascript in them.
    >>
    >> Why can't it just do whatever the free Script Editor does, it doesn't
    >> need
    >> to step back into the aspx page source, if it just stepped into something
    >> that could display where it is in the javascript that would be be a big
    >> improvement...
    >>
    >> I guess I begrudge paying so much for Visual Studio when it can't do
    >> something that a free tool by the same company can do.
    >>
    >> Also, when you debug serverside code, surely its actually the compiled IL
    >> that is running and the pdb files tell the debugger whereabouts in the
    >> source
    >> that is, so why can't the pdb files, or something similar, contain the
    >> info
    >> to tell the debugger where it is?
    >>
    >> If MS aren't looking to put this in to future versions of Visual Studio,
    >> I
    >> think they should... its a nightmare working on ajax apps where there is
    >> javascript code in the aspx pages.
    >>
    >> And I know given this limitation its probably good practice to just put
    >> all
    >> your javascript in .js files, but that doesn't help if your maintaining
    >> code
    >> that already has a lot of javascript in the pages.
    >>
    >> --
    >> Regards,
    >>
    >> Phillip Johnson (MCSD For .NET)
    >> PJ Software Development
    >> www.pjsoftwaredevelopment.com
    >>
    >>
    >> "Kevin Spencer" wrote:
    >>
    >> > Hi Phil,
    >> >
    >> > I tried to explain this to you. An ASPX page is a class that generates
    >> > HTML
    >> > from the server. It is not a client-side document. It CREATES a
    >> > client-side
    >> > document. The entire page code is actually a class that is executed on
    >> > the
    >> > server. Therefore, when you place a breakpoint anywhere in the page
    >> > code,
    >> > including any literal JavaScript in the page code, you are instructing
    >> > the
    >> > debugger to break DURING THE SERVER SIDE EXECUTION OF THE PAGE. A .js
    >> > file
    >> > is used by the client browser to execute JavaScript on the client side,
    >> > in
    >> > the browser. It is NOT server-side executable code.
    >> >
    >> > The Visual Studio JavaScript debugging tools are used to debug
    >> > client-side
    >> > scripting during its execution ON THE CLIENT. Therefore, you cannot
    >> > debug
    >> > JavaScript that is NOT executing during the execution of the
    >> > server-side
    >> > code. At that point, it is simply text in the server-side code, and is
    >> > NOT
    >> > executing.
    >> >
    >> > --
    >> > HTH,
    >> >
    >> > Kevin Spencer
    >> > Chicken Salad Surgeon
    >> > Microsoft MVP
    >> >
    >> > "Phil Johnson" <> wrote in message
    >> > news:...
    >> > > 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
    >> > > www.pjsoftwaredevelopment.com
    >> > >
    >> > >
    >> > > "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" <> a écrit dans
    >> > >> le
    >> > >> message de news:
    >> > >> ...
    >> > >> > 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
    >> > >>
    >> > >>
    >> > >>
    >> >
    >> >
    >> >
     
    Patrice, Jan 31, 2008
    #9
  10. Phil Johnson

    Phil Johnson Guest

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

    Hi Patrice,

    Yeah, thats right... re the javascript is in a script tag in the aspx page.

    I've got the correct settings on the option you mentioned in IE because the
    js files will debug fine and if I put a breakpoint in the javascript in an
    aspx page it does actually break and the code executing is at that point, you
    can step through etc, but Visual Studio does not display the correct line as
    being the current line to execute (even though when you do step through it
    executes the correct line, you just can't see which line it is going to
    execute on the screen).
    --
    Regards,

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


    "Patrice" wrote:

    > I'm on IE6. My first though would be that the appropriate option needs to be
    > checked in IE. "Tools" "Options" and make sure the "Deactive script
    > debugging" (translated from my french IE6 so it may vary in an english IE7)
    > is not checked. Could be also in Tools Options Debugging in VS but as it
    > follow a IE upgrade...
    >
    > To be crystal clear this is for javascript script code that is embeded
    > inside a client side script tag inside the aspx markup (not sure where the
    > breakpoints was as sometimes ASPX page is quite a vague term).
    >
    > --
    > Patrice
    >
    > "Phil Johnson" <> a écrit dans le
    > message de news: ...
    > > This guy has allegedly got debugging of javascript in aspx files workign
    > > in
    > > VS2005.
    > >
    > > http://www.ben-rush.net/blog/Commen...66ba-43e5-b0d6-4aa11c76d739&dotnet=consultant
    > >
    > > Also, I've seen it working on VS 2003 with IE6, but when the guy upgraded
    > > to
    > > IE7 it stopped working.
    > >
    > > You can obviously do this, does anybody know of a setting etc I could
    > > change
    > > to enable this?
    > >
    > > --
    > > Regards,
    > >
    > > Phillip Johnson (MCSD For .NET)
    > > PJ Software Development
    > > www.pjsoftwaredevelopment.com
    > >
    > >
    > > "Phil Johnson" wrote:
    > >
    > >> I get what your saying, but in that case how can a free tool like the
    > >> Microsoft Script Editor handle it right, but Visual Studio cannot.
    > >>
    > >> Visual Studio does some pretty amazing things, but this is a pretty big
    > >> limitation when working with application that have javascript in them.
    > >>
    > >> Why can't it just do whatever the free Script Editor does, it doesn't
    > >> need
    > >> to step back into the aspx page source, if it just stepped into something
    > >> that could display where it is in the javascript that would be be a big
    > >> improvement...
    > >>
    > >> I guess I begrudge paying so much for Visual Studio when it can't do
    > >> something that a free tool by the same company can do.
    > >>
    > >> Also, when you debug serverside code, surely its actually the compiled IL
    > >> that is running and the pdb files tell the debugger whereabouts in the
    > >> source
    > >> that is, so why can't the pdb files, or something similar, contain the
    > >> info
    > >> to tell the debugger where it is?
    > >>
    > >> If MS aren't looking to put this in to future versions of Visual Studio,
    > >> I
    > >> think they should... its a nightmare working on ajax apps where there is
    > >> javascript code in the aspx pages.
    > >>
    > >> And I know given this limitation its probably good practice to just put
    > >> all
    > >> your javascript in .js files, but that doesn't help if your maintaining
    > >> code
    > >> that already has a lot of javascript in the pages.
    > >>
    > >> --
    > >> Regards,
    > >>
    > >> Phillip Johnson (MCSD For .NET)
    > >> PJ Software Development
    > >> www.pjsoftwaredevelopment.com
    > >>
    > >>
    > >> "Kevin Spencer" wrote:
    > >>
    > >> > Hi Phil,
    > >> >
    > >> > I tried to explain this to you. An ASPX page is a class that generates
    > >> > HTML
    > >> > from the server. It is not a client-side document. It CREATES a
    > >> > client-side
    > >> > document. The entire page code is actually a class that is executed on
    > >> > the
    > >> > server. Therefore, when you place a breakpoint anywhere in the page
    > >> > code,
    > >> > including any literal JavaScript in the page code, you are instructing
    > >> > the
    > >> > debugger to break DURING THE SERVER SIDE EXECUTION OF THE PAGE. A .js
    > >> > file
    > >> > is used by the client browser to execute JavaScript on the client side,
    > >> > in
    > >> > the browser. It is NOT server-side executable code.
    > >> >
    > >> > The Visual Studio JavaScript debugging tools are used to debug
    > >> > client-side
    > >> > scripting during its execution ON THE CLIENT. Therefore, you cannot
    > >> > debug
    > >> > JavaScript that is NOT executing during the execution of the
    > >> > server-side
    > >> > code. At that point, it is simply text in the server-side code, and is
    > >> > NOT
    > >> > executing.
    > >> >
    > >> > --
    > >> > HTH,
    > >> >
    > >> > Kevin Spencer
    > >> > Chicken Salad Surgeon
    > >> > Microsoft MVP
    > >> >
    > >> > "Phil Johnson" <> wrote in message
    > >> > news:...
    > >> > > 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
    > >> > > www.pjsoftwaredevelopment.com
    > >> > >
    > >> > >
    > >> > > "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" <> a écrit dans
    > >> > >> le
    > >> > >> message de news:
    > >> > >> ...
    > >> > >> > 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
    > >> > >>
    > >> > >>
    > >> > >>
    > >> >
    > >> >
    > >> >

    >
    >
    >
     
    Phil Johnson, Jan 31, 2008
    #10
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. wh
    Replies:
    2
    Views:
    566
    Cowboy \(Gregory A. Beamer\)
    Jan 16, 2004
  2. Thirumalai
    Replies:
    0
    Views:
    727
    Thirumalai
    May 22, 2006
  3. rockdale
    Replies:
    1
    Views:
    666
    Juan T. Llibre
    Aug 23, 2006
  4. xman
    Replies:
    0
    Views:
    548
  5. sinbad

    adding debugs in the code

    sinbad, Sep 6, 2012, in forum: C Programming
    Replies:
    5
    Views:
    354
    ralph
    Sep 6, 2012
Loading...

Share This Page