Debugging a Class Library used in a Web Application

Discussion in 'ASP .Net' started by Nathan Sokalski, Mar 5, 2010.

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

    http://www.nathansokalski.com/
    Nathan Sokalski, Mar 5, 2010
    #1
    1. Advertising

  2. Nathan Sokalski

    Scott M. Guest

    "Nathan Sokalski" <> wrote in message
    news:...
    >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
    Scott M., Mar 5, 2010
    #2
    1. Advertising

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

    http://www.nathansokalski.com/

    "Scott M." <> wrote in message
    news:...
    >
    > "Nathan Sokalski" <> wrote in message
    > news:...
    >>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
    >
    Nathan Sokalski, Mar 5, 2010
    #3
  4. Nathan Sokalski

    Mr. Arnold Guest

    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.
    Mr. Arnold, Mar 5, 2010
    #4
  5. 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

    http://www.nathansokalski.com/

    "Mr. Arnold" <> wrote in message
    news:...
    > 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.
    Nathan Sokalski, Mar 5, 2010
    #5
  6. Nathan Sokalski

    Scott M. Guest

    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" <> wrote in message
    news:...
    > 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
    >
    > http://www.nathansokalski.com/
    >
    > "Scott M." <> wrote in message
    > news:...
    >>
    >> "Nathan Sokalski" <> wrote in message
    >> news:...
    >>>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
    >>
    Scott M., Mar 6, 2010
    #6
  7. 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

    http://www.nathansokalski.com/

    "Scott M." <> wrote in message
    news:...
    > 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" <> wrote in message
    > news:...
    >> 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
    >>
    >> http://www.nathansokalski.com/
    >>
    >> "Scott M." <> wrote in message
    >> news:...
    >>>
    >>> "Nathan Sokalski" <> wrote in message
    >>> news:...
    >>>>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
    >>>

    >
    >
    Nathan Sokalski, Mar 6, 2010
    #7
  8. Nathan Sokalski

    Scott M. Guest

    "Nathan Sokalski" <> wrote in message
    news:...
    > 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
    Scott M., Mar 6, 2010
    #8
  9. Nathan Sokalski

    Andy O'Neill Guest

    "Nathan Sokalski" <> wrote in message
    news:%...
    > 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.
    Andy O'Neill, Mar 6, 2010
    #9
    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. =?Utf-8?B?VG9tX0I=?=

    Debugging Class Library

    =?Utf-8?B?VG9tX0I=?=, May 8, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    2,084
    =?Utf-8?B?VG9tX0I=?=
    May 9, 2004
  2. Mythran
    Replies:
    0
    Views:
    2,420
    Mythran
    Aug 24, 2004
  3. Alan Ferrandiz [MCT]
    Replies:
    0
    Views:
    445
    Alan Ferrandiz [MCT]
    Sep 11, 2004
  4. Replies:
    0
    Views:
    407
  5. E11
    Replies:
    1
    Views:
    4,743
    Thomas Weidenfeller
    Oct 12, 2005
Loading...

Share This Page