Debugging - How to "step into"

G

Gerry

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.
 
A

Andy O'Neill

Gerry said:
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.
 
G

Gerry

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.
 
G

Gerry

System.Net.WebClient webClient = new WebClient();
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.
 
J

Jeff Johnson

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.
 
G

Gerry

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.
 
P

Patrice

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...
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top