PC Review


Reply
Thread Tools Rating: Thread Rating: 2 votes, 1.00 average.

Debugging a Class Library used in a Web Application

 
 
Nathan Sokalski
Guest
Posts: n/a
 
      5th Mar 2010
I have two projects in the same Solution, one of which is a Web Application,
the other of which is a Class Library. When debugging, if I put a breakpoint
in the Web Application, it stops there when it should, but the debugger
refuses to stop at the breakpoints in the Class Library. Is there something
special I need to do when debugging a Class Library while using it in a Web
Application? Thanks.
--
Nathan Sokalski
(E-Mail Removed)
http://www.nathansokalski.com/

 
Reply With Quote
 
 
 
 
Scott M.
Guest
Posts: n/a
 
      5th Mar 2010

"Nathan Sokalski" <(E-Mail Removed)> wrote in message
news:4D3BF4D3-752A-46DE-965E-(E-Mail Removed)...
>I have two projects in the same Solution, one of which is a Web
>Application, the other of which is a Class Library. When debugging, if I
>put a breakpoint in the Web Application, it stops there when it should, but
>the debugger refuses to stop at the breakpoints in the Class Library. Is
>there something special I need to do when debugging a Class Library while
>using it in a Web Application? Thanks.


Yes, place another breakpoint in the Class Library code at whatever the
entry points are.

-Scott


 
Reply With Quote
 
Nathan Sokalski
Guest
Posts: n/a
 
      5th Mar 2010
What would the entry point be? The specific class in the Class Library that
I am trying to debug inherits from System.Web.UI.WebControls.Image, and my
breakpoint is in an override of the Render method. I would think the entry
point would be the tag in the *.aspx file, but that obviously isn't right,
since breakpoints aren't allowed in *.aspx files. Where do I need to put the
additional breakpoint? Thanks.
--
Nathan Sokalski
(E-Mail Removed)
http://www.nathansokalski.com/

"Scott M." <s-(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> "Nathan Sokalski" <(E-Mail Removed)> wrote in message
> news:4D3BF4D3-752A-46DE-965E-(E-Mail Removed)...
>>I have two projects in the same Solution, one of which is a Web
>>Application, the other of which is a Class Library. When debugging, if I
>>put a breakpoint in the Web Application, it stops there when it should,
>>but the debugger refuses to stop at the breakpoints in the Class Library.
>>Is there something special I need to do when debugging a Class Library
>>while using it in a Web Application? Thanks.

>
> Yes, place another breakpoint in the Class Library code at whatever the
> entry points are.
>
> -Scott
>

 
Reply With Quote
 
Mr. Arnold
Guest
Posts: n/a
 
      5th Mar 2010
Nathan Sokalski wrote:
> I have two projects in the same Solution, one of which is a Web
> Application, the other of which is a Class Library. When debugging, if I
> put a breakpoint in the Web Application, it stops there when it should,
> but the debugger refuses to stop at the breakpoints in the Class
> Library. Is there something special I need to do when debugging a Class
> Library while using it in a Web Application? Thanks.


You can break at the line in the codebehind file that calls the methods
in the classlib project. You single step into the project's method and
from there it should stop at a breakpoint that has been set.
 
Reply With Quote
 
Nathan Sokalski
Guest
Posts: n/a
 
      5th Mar 2010
The Class Library is a library of controls, so there is no line in the
codebehind that calls it, because it is called from the *.aspx file as
controls.
--
Nathan Sokalski
(E-Mail Removed)
http://www.nathansokalski.com/

"Mr. Arnold" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Nathan Sokalski wrote:
>> I have two projects in the same Solution, one of which is a Web
>> Application, the other of which is a Class Library. When debugging, if I
>> put a breakpoint in the Web Application, it stops there when it should,
>> but the debugger refuses to stop at the breakpoints in the Class Library.
>> Is there something special I need to do when debugging a Class Library
>> while using it in a Web Application? Thanks.

>
> You can break at the line in the codebehind file that calls the methods in
> the classlib project. You single step into the project's method and from
> there it should stop at a breakpoint that has been set.


 
Reply With Quote
 
Scott M.
Guest
Posts: n/a
 
      6th Mar 2010
If your webpage code-behind is making an instance of a class then the entry
point would be the constructor of the class in the class library project.

-Scott


"Nathan Sokalski" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> What would the entry point be? The specific class in the Class Library
> that I am trying to debug inherits from System.Web.UI.WebControls.Image,
> and my breakpoint is in an override of the Render method. I would think
> the entry point would be the tag in the *.aspx file, but that obviously
> isn't right, since breakpoints aren't allowed in *.aspx files. Where do I
> need to put the additional breakpoint? Thanks.
> --
> Nathan Sokalski
> (E-Mail Removed)
> http://www.nathansokalski.com/
>
> "Scott M." <s-(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>>
>> "Nathan Sokalski" <(E-Mail Removed)> wrote in message
>> news:4D3BF4D3-752A-46DE-965E-(E-Mail Removed)...
>>>I have two projects in the same Solution, one of which is a Web
>>>Application, the other of which is a Class Library. When debugging, if I
>>>put a breakpoint in the Web Application, it stops there when it should,
>>>but the debugger refuses to stop at the breakpoints in the Class Library.
>>>Is there something special I need to do when debugging a Class Library
>>>while using it in a Web Application? Thanks.

>>
>> Yes, place another breakpoint in the Class Library code at whatever the
>> entry points are.
>>
>> -Scott
>>



 
Reply With Quote
 
Nathan Sokalski
Guest
Posts: n/a
 
      6th Mar 2010
I'm a little confused as to were to put everything. Is there an example
available anywhere that I can look at? Thanks.
--
Nathan Sokalski
(E-Mail Removed)
http://www.nathansokalski.com/

"Scott M." <s-(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> If your webpage code-behind is making an instance of a class then the
> entry point would be the constructor of the class in the class library
> project.
>
> -Scott
>
>
> "Nathan Sokalski" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> What would the entry point be? The specific class in the Class Library
>> that I am trying to debug inherits from System.Web.UI.WebControls.Image,
>> and my breakpoint is in an override of the Render method. I would think
>> the entry point would be the tag in the *.aspx file, but that obviously
>> isn't right, since breakpoints aren't allowed in *.aspx files. Where do I
>> need to put the additional breakpoint? Thanks.
>> --
>> Nathan Sokalski
>> (E-Mail Removed)
>> http://www.nathansokalski.com/
>>
>> "Scott M." <s-(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>>
>>> "Nathan Sokalski" <(E-Mail Removed)> wrote in message
>>> news:4D3BF4D3-752A-46DE-965E-(E-Mail Removed)...
>>>>I have two projects in the same Solution, one of which is a Web
>>>>Application, the other of which is a Class Library. When debugging, if I
>>>>put a breakpoint in the Web Application, it stops there when it should,
>>>>but the debugger refuses to stop at the breakpoints in the Class
>>>>Library. Is there something special I need to do when debugging a Class
>>>>Library while using it in a Web Application? Thanks.
>>>
>>> Yes, place another breakpoint in the Class Library code at whatever the
>>> entry points are.
>>>
>>> -Scott
>>>

>
>

 
Reply With Quote
 
Scott M.
Guest
Posts: n/a
 
      6th Mar 2010

"Nathan Sokalski" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I'm a little confused as to were to put everything. Is there an example
> available anywhere that I can look at? Thanks.


1. You've got two projects; a web UI and a class library project.
2. You set a breakpoint in the code-behind of a file in the web UI project
where you would like to start debugging.
3. You set a breakpoint in the code of the class in the class library
project that will be called by your web UI project.

If your web UI project is making an instance of a class in your class
library project, just set a breakpoint on that class's constructor.

That's all there is to it.

-Scott


 
Reply With Quote
 
Andy O'Neill
Guest
Posts: n/a
 
      6th Mar 2010
"Nathan Sokalski" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> The Class Library is a library of controls, so there is no line in the
> codebehind that calls it, because it is called from the *.aspx file as
> controls.


Inside your library you have classes which inherit from controls.
Stick a break point in the constructor of the relevent class.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Debugging a Class Library used in a Web Application Nathan Sokalski Microsoft ASP .NET 8 6th Mar 2010 11:09 AM
Debugging a Class Library used in a Web Application Nathan Sokalski Microsoft VB .NET 8 6th Mar 2010 11:09 AM
Debugging a COM Interop Class Library =?Utf-8?B?R3JlZw==?= Microsoft VB .NET 4 22nd Nov 2006 08:55 PM
Debugging a class library in Compact Framework =?Utf-8?B?U2ltb24gSGFydA==?= Microsoft Dot NET Compact Framework 2 20th Oct 2005 02:47 PM
Debugging Class Library =?Utf-8?B?VG9tX0I=?= Microsoft ASP .NET 2 9th May 2004 01:11 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:46 PM.