How to debug custom control?

G

Guest

Hi,

I'm writing a custom control in .net cf. Is there anyway I can set break
points on my code and debug it? When I tried to debug it, I got a message
that asked me to set the Start Action (in Project Properties) to Start
External Program which I didn't see it in the dropdown list. I set Debug Mode
to Program and Start Application to my test application, it doesn't work.
Then I added my test project to the solution and set it as startup project,
but the breakpoints in custom control code were marked with question marks
and didn't work.

Thanks,

Lei
 
G

Guest

Thanks Daniel,

The article you mentioned is useful. However what I want to know is how to
debug its runtime functions, not designtime.

Lei
 
D

Daniel Moth

Oh, I see. To be perfectly honest I have never done it that way.

Question marks on breakpoints means that the module in which the code
resides is not loaded. So your project is not running against the code you
think it is running. The classic example is referencing a dll rather than
the class library project in the same solution.

BTW, I always create my custom controls manually (not thru the designer) so
there is only one version of them and debugging that way is the same as
debugging against any normal class.

Cheers
Daniel
 
G

Guest

Yes, Daniel. Finally I realized that a custom control is a class library. So
I created a test application, added reference to the library, then added code
manually to create the custom control. By this way, I can debug it. When
debugging is finished, I'll debug its design behavior according to your first
reply.

Thanks,

Lei
 

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

Top