Debugging - How to "step into"

Discussion in 'ASP .Net Web Services' started by Gerry, Feb 17, 2010.

  1. Gerry

    Gerry Guest

    Hi there,

    I'm making a call to the following from a standalone ".exe":

    System.Net.WebClient webClient = new WebClient();
    webClient.UploadData("http://localhost//MyPage.aspx", whatever);

    Does anyone know how to trigger a breakpoint in the "Page_load()" method of
    "MyPage.aspx". I want to step into this but nothing I've tried works. Note
    that "Page_Load()" is being called however and breakpoints work if I set
    them when debugging the web app itself. Thank you.
     
    Gerry, Feb 17, 2010
    #1
    1. Advertising

  2. Gerry

    Andy O'Neill Guest

    "Gerry" <_no_spam@_no_spam.com> wrote in message
    news:%23BfUrT$...
    > Hi there,
    >
    > I'm making a call to the following from a standalone ".exe":
    >
    > System.Net.WebClient webClient = new WebClient();
    > webClient.UploadData("http://localhost//MyPage.aspx", whatever);
    >
    > Does anyone know how to trigger a breakpoint in the "Page_load()" method
    > of "MyPage.aspx". I want to step into this but nothing I've tried works.
    > Note that "Page_Load()" is being called however and breakpoints work if I
    > set them when debugging the web app itself. Thank you.

    The web page is going to be handled by the worker process.
    I have very rarely had to do something where I couldn't just debug the web
    page itself.
    As I recall you use the clr debugger to attach to the worker process.
    A quick google and there seem to be articles on doing this.
     
    Andy O'Neill, Feb 17, 2010
    #2
    1. Advertising

  3. Gerry

    Gerry Guest

    > The web page is going to be handled by the worker process.
    > I have very rarely had to do something where I couldn't just debug the web
    > page itself.
    > As I recall you use the clr debugger to attach to the worker process.
    > A quick google and there seem to be articles on doing this.


    I'll look into this. Thanks for your help.
     
    Gerry, Feb 17, 2010
    #3
  4. Gerry

    Gerry Guest

    >> System.Net.WebClient webClient = new WebClient();
    >> webClient.UploadData("http://localhost//MyPage.aspx", whatever);
    >>
    >> Does anyone know how to trigger a breakpoint in the "Page_load()" method
    >> of "MyPage.aspx". I want to step into this but nothing I've tried works.
    >> Note that "Page_Load()" is being called however and breakpoints work if I
    >> set them when debugging the web app itself. Thank you.

    >
    > Hi, IMO your method is correct (i.e put a breakpoint in the web app) and
    > you can't do otherwise.
    >
    > Technically speaking you just send data to a URL. As this is not an
    > explicit call, it would be quite difficult to have the debugger parsing
    > the url to see this is an ASPX web app, to find out that this is on your
    > localhost and to locate the corresponding solution etc...


    Understood but there should be a way to do this. Hardcoding a
    "Debugger.Break()" statement for instance is ignored.
     
    Gerry, Feb 17, 2010
    #4
  5. Gerry

    Jeff Johnson Guest

    "Gerry" <_no_spam@_no_spam.com> wrote in message
    news:OFfVWj$...

    >>> System.Net.WebClient webClient = new WebClient();
    >>> webClient.UploadData("http://localhost//MyPage.aspx", whatever);
    >>>
    >>> Does anyone know how to trigger a breakpoint in the "Page_load()" method
    >>> of "MyPage.aspx". I want to step into this but nothing I've tried works.
    >>> Note that "Page_Load()" is being called however and breakpoints work if
    >>> I set them when debugging the web app itself. Thank you.

    >>
    >> Hi, IMO your method is correct (i.e put a breakpoint in the web app) and
    >> you can't do otherwise.
    >>
    >> Technically speaking you just send data to a URL. As this is not an
    >> explicit call, it would be quite difficult to have the debugger parsing
    >> the url to see this is an ASPX web app, to find out that this is on your
    >> localhost and to locate the corresponding solution etc...

    >
    > Understood but there should be a way to do this. Hardcoding a
    > "Debugger.Break()" statement for instance is ignored.


    What you're not understanding is that the Web site is running completely
    independently of Visual Studio, so it is outside the scope of your debugging
    session. VS doesn't have "tentacles" that reach out to any and every process
    that's accessed by your program and step into them; you'd have to be
    explicitly debugging that other process as well.
     
    Jeff Johnson, Feb 17, 2010
    #5
  6. Gerry

    Gerry Guest

    > What you're not understanding is that the Web site is running completely
    > independently of Visual Studio, so it is outside the scope of your
    > debugging session.


    I understand this clearly. Putting a "Diagnostics.Debugger.Break()"
    statement in however should invoke the debugger or prompt the user to start
    the debugger (any debugger you want to attach, not necessarily VS). I've now
    got things working by attaching to the ASP.NET process and using a normal
    break point in VS itself. Thanks for everyone's help.
     
    Gerry, Feb 17, 2010
    #6
  7. Gerry

    Patrice Guest

    > Understood but there should be a way to do this. Hardcoding a
    > "Debugger.Break()" statement for instance is ignored.


    What if we restart fresh to understand te whole picture ? It seems to me
    that you are trying to debug a Windows application and that when at some
    point in this app, you hit a Web application you woudl like to be able to
    debug this web application. All this is on your dev box and projects are
    available. Is this correct ?

    Have you tried to launch two instances of VS for each project ? In the web
    app, you have an option to "wait for an external request". Then run your
    Windows project and you'll get control in the other instance when the web
    app is hit.

    Is this what you are looking for ? Else I would suggest coming back at the
    overall goal, sorry but I'm confused by those details and how you would like
    it to work but not sure about your overall goal...

    --
    Patrice
     
    Patrice, Feb 18, 2010
    #7
    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. R Millman
    Replies:
    3
    Views:
    435
    Yan-Hong Huang[MSFT]
    Aug 6, 2003
  2. FN
    Replies:
    1
    Views:
    488
    [MVP] SmileSeo
    Oct 18, 2003
  3. Bernd Oninger
    Replies:
    1
    Views:
    927
    Oliver Wong
    Mar 31, 2006
  4. Robin Mark Tucker

    Debugging - can step over, but not step into.....

    Robin Mark Tucker, Jun 1, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    789
    Robin Mark Tucker
    Jun 5, 2006
  5. Gerry

    Debugging - How to "step into"

    Gerry, Feb 17, 2010, in forum: ASP .Net
    Replies:
    6
    Views:
    473
    Patrice
    Feb 18, 2010
Loading...

Share This Page