how to debug your custom modules?

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
3/5/2013 2:21:02 PM
Gravatar
Total Posts 14

how to debug your custom modules?

Hi,

I'm trying to develop a custom module in Visual Studio 2010, my Mojo version is 2.3.9.5 MSSQL.

Created 3 layers, UI, Business and Data, following this great example (http://techblog.strongeye.com/archive/2009/12/16/creating-a-mojoportal-module.aspx).

So I have a beautiful module now, I can add it to my pages, but so far I have not been able to get my custom data in this module. I'm trying to debug the module from the Web.UI-project, but in neither of my 3 layers my breakpoints are hit. In VS2010 it says 'this breakpoint will not currently be hit. No symbols have been loaded for this document.'  If I set any breakpoints in other modules, the Blog for example, I cán debug.

Can anybody point me in the right direction?

 

TIA,

 

Sjors

 

 

 

3/5/2013 2:35:12 PM
Gravatar
Total Posts 18439

Re: how to debug your custom modules?

I would look under the Build menu in configuration manager and make sure that when the solution is set to Debug build in the dropdown that your own projects are also set to debug. Then I would rebuild the entire solution in debug mode before launching the mojoPortal.Web project in the debugger (mojoPortal.Web must always be the startup project since features must run in the context of the mojoPortal web app).

Hope that helps,

Joe

3/5/2013 2:59:34 PM
Gravatar
Total Posts 14

Re: how to debug your custom modules?

Hi Joe, thanks for answering.

I checked the configuration manager, but all projects are set to debug. I always run the mojoPortal.Web as startup project. 

What about the namespace, do I create my own, or do I have to use something like 'mojoportal.web.x'?

3/5/2013 3:07:52 PM
Gravatar
Total Posts 18439

Re: how to debug your custom modules?

you should use your own namespace and make sure it matches in the declaration at the top of .ascx and .aspx files as it is in code behind files. If it doesn't match then it would not hit the breakpoint.

3/5/2013 3:47:28 PM
Gravatar
Total Posts 14

Re: how to debug your custom modules?

my ascx  starts with : "<%@ Control Language="C#" AutoEventWireup="false" CodeBehind="uitslagen.ascx.cs" Inherits="scvalburg.UI.scvalburgModule" %>

 

The code behind starts with

namespace scvalburg.UI
{

    public partial class scvalburgModule : SiteModuleControl

 

3/6/2013 3:01:40 PM
Gravatar
Total Posts 18439

Re: how to debug your custom modules?

Do you have a post build event that copies your updated .ascx, .ascx and dll files into the Web project after each time you build?

I would make sure your dll is getting copied to the Web/bin folder and though I have never needed to do this you might try copying the .pdb files from your projects bin folders into Web/bin

3/6/2013 3:22:59 PM
Gravatar
Total Posts 14

Re: how to debug your custom modules?

Hey Joe,

 

I do have a postbuild event. While checking which files are being copied, I noticed that I don't have a .pdb file for my custom UI-project, I do have pdb's for Data and Business. Might that be the problem for not being able to debug? How would I get a .pdb?


Thanks again!

3/6/2013 3:41:59 PM
Gravatar
Total Posts 18439

Re: how to debug your custom modules?

I would look around in the project properties (right click project node) for the one that is not generating pdb files and compare to other projects that are. I'm not really sure which setting it would be, I've never had to do anything special for my projects to generate them on build. But my post build events don't copy any pdb files and I've never had any trouble debugging. ie the mojoPortal.Features set of projects don't copy their pdbs into Web/bin and I've never had any problem debugging them so I'm really reaching for possibilities about what is causing that.

I definitely would check the mojoPortal log under Administration > System Log because if your feature module control throws an error on page load it will be trapped and logged to prevent crashing the page. Depending on where you put your break point it may never hit it in that case.

3/6/2013 3:49:58 PM
Gravatar
Total Posts 14

Re: how to debug your custom modules?

hmm, your last remark could be the jackpot:

 

2013-03-06 22:46:22,439 ERROR 192.168.0.11 - nl-NL - /test-voor-uitslagen-module.aspx - mojoPortal.Web.UI.CmsPage - failed to load control scvalburg/uitslagen.ascx 
System.Web.HttpParseException (0x80004005): Kan het type scvalburg.UI.scvalburgModule niet laden. ---> System.Web.HttpParseException (0x80004005): Kan het type scvalburg.UI.scvalburgModule niet laden. ---> System.Web.HttpException (0x80004005): Kan het type scvalburg.UI.scvalburgModule niet laden.
   bij System.Web.UI.TemplateParser.GetType(String typeName, Boolean ignoreCase, Boolean throwOnError)
   bij System.Web.UI.TemplateParser.ProcessInheritsAttribute(String baseTypeName, String codeFileBaseTypeName, String src, Assembly assembly)
   bij System.Web.UI.TemplateParser.PostProcessMainDirectiveAttributes(IDictionary parseData)
   bij System.Web.UI.TemplateParser.ProcessException(Exception ex)
   bij System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding)
   bij System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding)
   bij System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding)
   bij System.Web.UI.TemplateParser.ParseFile(String physicalPath, VirtualPath virtualPath)
   bij System.Web.UI.TemplateParser.ParseInternal()
   bij System.Web.UI.TemplateParser.Parse()
   bij System.Web.Compilation.BaseTemplateBuildProvider.get_CodeCompilerType()
   bij System.Web.Compilation.BuildProvider.GetCompilerTypeFromBuildProvider(BuildProvider buildProvider)
   bij System.Web.Compilation.BuildProvidersCompiler.ProcessBuildProviders()
   bij System.Web.Compilation.BuildProvidersCompiler.PerformBuild()
   bij System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath)
   bij System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
   bij System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate)
   bij System.Web.UI.TemplateControl.LoadControl(VirtualPath virtualPath)
   bij System.Web.UI.TemplateControl.LoadControl(String virtualPath)
   bij mojoPortal.Web.UI.CmsPage.LoadPage() in C:\MojoPortal\Web\Default.aspx.cs:regel 329

 

3/6/2013 3:58:19 PM
Gravatar
Total Posts 18439

Re: how to debug your custom modules?

So the copy of the .ascx file beneath Web has has an incorrect Inherits declaration

You said before it matched the namespace and class in your code behind so maybe your post build event is failing to copy the updated .ascx file

3/6/2013 4:14:25 PM
Gravatar
Total Posts 14

Re: how to debug your custom modules?

YES!

 

checked and double checked my project's settings. I missed 2 settings: Assembly name and Default namespace were point to Web.UI instead of scvalburg.UI. So, now I can start debugging!

 

Thank you very much, I will definitely buy you a beer!

3/6/2013 5:19:33 PM
Gravatar
Total Posts 18439

Re: how to debug your custom modules?

Glad its working! Thanks for the beer!

Cheers,

Joe

You must sign in to post in the forums. This thread is closed to new posts.