How do you debug a module ?

Last post 10-20-2005 1:08 PM by Lennon][. 14 replies.

Sort Posts:

  • How do you debug a module ?

    10-18-2005, 4:30 PM
    • Member
      185 point Member
    • Robbie
    • Member since 05-25-2005, 10:36 AM
    • Posts 37
    Hi,

    I am new to module development. I am wondering how you debug a module. I can see that you cant just press F5 in vs.net as there is only one real web page and all module are user controls. I am also able to build a hello world module and view it in DNN by adding a new module definition.

    But I cant work out how to go about debugging and testing in an efficient way. How do you add a few lines of code and then execute and see the results come to think of it how do you step through to debug problems ?


    Any advice would be much appreciated.


    Thanks

    Rob
  • Re: How do you debug a module ?

    10-18-2005, 5:28 PM
    • Member
      450 point Member
    • linguinut
    • Member since 11-26-2002, 8:00 AM
    • Romulus, Michigan
    • Posts 90
    Nik has a good solution for this.

    Ling
  • Re: How do you debug a module ?

    10-19-2005, 5:36 AM
    • Member
      185 point Member
    • Robbie
    • Member since 05-25-2005, 10:36 AM
    • Posts 37

    Thanks Ling.

    I now have the MyModules solution and it works well. I see there is a Default.aspx in the stub project.

    I still dont see how you step through code though. If I insert a break point in my ascx file it is not stepped into because DNN is using the compiled dll.
     
    So even with this solution do I still have to make a change > complie dll> open Default aspx>navigate to my control ?.. and also work with out break points?

    I think I am missing something.


    Cheers

    Rob

  • Re: How do you debug a module ?

    10-19-2005, 6:10 AM
    • Contributor
      3,120 point Contributor
    • donker
    • Member since 05-21-2003, 9:19 AM
    • Neuchâtel, Switzerland
    • Posts 629
    My method: my VS 'solutions' do not include DNN, only the module as a dll project. Then go to Debug menu and select 'Processes ...'. Select the asp.net worker process and you're in debugging mode.
    Peter Donker
    bring2mind.net
    Home of Document Exchange, the document management solution for DNN
  • Re: How do you debug a module ?

    10-19-2005, 8:44 AM
    • Contributor
      2,030 point Contributor
    • SamTanner
    • Member since 02-08-2004, 7:04 PM
    • US Gulf Coast
    • Posts 406
     donker wrote:
    My method: my VS 'solutions' do not include DNN, only the module as a dll project.

    Interesting... I assume your solution would contain two projects: the module and the dataprovider?
    Could you please elaborate on this method, the set-up, etc?
  • Re: How do you debug a module ?

    10-19-2005, 8:58 AM
    • Member
      450 point Member
    • linguinut
    • Member since 11-26-2002, 8:00 AM
    • Romulus, Michigan
    • Posts 90
    Hey Robbie,

    I think Nik includes a DNNDebug.aspx page to walk through the code.  Not used it myself, though, I bet I will soon.

    Ling
  • Re: How do you debug a module ?

    10-19-2005, 9:02 AM
    • Contributor
      3,120 point Contributor
    • donker
    • Member since 05-21-2003, 9:19 AM
    • Neuchâtel, Switzerland
    • Posts 629
     SamTanner wrote:
     donker wrote:
    My method: my VS 'solutions' do not include DNN, only the module as a dll project.

    Interesting... I assume your solution would contain two projects: the module and the dataprovider?
    Could you please elaborate on this method, the set-up, etc?

    It is pretty straightforward: you have your solution with module and dataprovider projects. Then you reference in each of them the dotnetnuke.dll. I compile the debug version straight into the dotnetnuke/bin dir, the release version into it's own bin directory. If you want examples: all the modules on my site are done this way. Just check out one of the source versions.
    Peter
    Peter Donker
    bring2mind.net
    Home of Document Exchange, the document management solution for DNN
  • Re: How do you debug a module ?

    10-19-2005, 11:20 AM
    • Participant
      1,710 point Participant
    • onyaktech
    • Member since 09-08-2004, 4:33 PM
    • Ohio, USA
    • Posts 342
    I code modules the same as Donker.  My modules are DLL projects and the solution only contains the module project and it's data provider.  (References are setup as...Data provider references the module project and the core DNN dll.  The module project references DNN.)  None of my projects are web projects, just component libraries.  Having your module setup as a web project adds additional unnecessary processing with the IDE.

    For me, it's the only way to code for DNN.  Having the DotNetNuke project and related in your solution is a mess. 

    For debugging, I just build and then hit refresh on my browser.  If I find a spot that needs to be debugged, I set break points and then attach to the aspnet_wp.exe process from the debug menu.

    Attaching to the ASP.Net process involves a few more steps rather then just hitting F5.  But... after experimenting with all the different possabilities of debuging a DNN module I found this to be the best solution over-all.   
    Chris Onyak
    www.OnyakTech.com


    DotNetNuke Gold Benefactor 

  • Re: How do you debug a module ?

    10-19-2005, 11:42 AM
    • Member
      450 point Member
    • linguinut
    • Member since 11-26-2002, 8:00 AM
    • Romulus, Michigan
    • Posts 90

    Peter has it streamlined about as far as one can take it.  I have been developing my last few modules this way.  It works great without all of the complications from the core projects.  I was getting some build warnings that I am trying to work through which is why I was introduced to MyModules.  I am still getting those build warnings.  I wonder if it has something to do with files being open by the IIS...anyway, I digress.  I will also try the MyGeneration software, too.  I am curious how that handles the project development (although, I doubt I will seriously lean on it for my custom mods).

    Well, it's time for wading into the MyModules setup a little futher.

    Enjoy!
    Ling

  • Re: How do you debug a module ?

    10-19-2005, 11:43 AM
    • Member
      450 point Member
    • linguinut
    • Member since 11-26-2002, 8:00 AM
    • Romulus, Michigan
    • Posts 90

    www.dnndirectory.com

    Btw, the link does not seem to work.

  • Re: How do you debug a module ?

    10-19-2005, 12:16 PM
    • Member
      450 point Member
    • linguinut
    • Member since 11-26-2002, 8:00 AM
    • Romulus, Michigan
    • Posts 90
     onyaktech wrote:
    I set break points and then attach to the aspnet_wp.exe process from the debug menu.


    Very interesting.  Which program types do you select?  And, then...how do you start the debugger?

    Ling
  • Re: How do you debug a module ?

    10-20-2005, 2:00 AM
    • Participant
      1,710 point Participant
    • onyaktech
    • Member since 09-08-2004, 4:33 PM
    • Ohio, USA
    • Posts 342

    I use Class Library as project type.

    When you select aspnet_wp.exe from the Processes window from the Debug menu, Visual Studio .Net automatically starts the debugger and attaches to IIS.  Note that you must first have initiated ASP.net by browsing to your local DNN site in order to even see aspnet_wp.exe listed.

    This is also a great way to remotely debug modules as well.  For example, I had a problem with a module running on a production server and I couldn't duplicate it on the test server.  So I remotely attached to the aspnet_wp.exe process running on the production server and set break points in code.  Then...debugged away.

    Chris Onyak
    www.OnyakTech.com


    DotNetNuke Gold Benefactor 

  • Re: How do you debug a module ?

    10-20-2005, 7:45 AM
    • Member
      450 point Member
    • linguinut
    • Member since 11-26-2002, 8:00 AM
    • Romulus, Michigan
    • Posts 90
    Raw, unbridled debugging power!  Suh-weet!

    Thanks a ton for the tip!  Good stuff.

    Ling
  • Re: How do you debug a module ?

    10-20-2005, 9:36 AM
    • Member
      185 point Member
    • Robbie
    • Member since 05-25-2005, 10:36 AM
    • Posts 37
    Thanks All for some great debugging  tips.

  • Re: How do you debug a module ?

    10-20-2005, 1:08 PM
    • Member
      720 point Member
    • Lennon][
    • Member since 05-10-2005, 2:05 PM
    • Posts 140
    Lovely stuff
Page 1 of 1 (15 items)