Problems getting Dev copy working with Visual Studio 2010

Post here for help with installing or upgrading mojoPortal pre-compiled release packages. When posting in this forum, please provide all relevant details. You may also want to review the installation or upgrading documentation.

If you have questions about using the source code or working with mojoPortal in Visual Studio, please post in the Developer forum.

Post here for help with installation of mojoPortal pre-compiled release packages

When posting in this forum, please try to provide as many relevant details as possible. Particularly the following:

  • What operating system were you running when the bug appeared?
  • What database platform is your site using?
  • What version of mojoPortal are you running?
  • What version of .NET do you use?
  • What steps are necessary to reproduce the issue? Compare expected results vs actual results.

You may also want to review the installation or upgrading documentation.

If you have questions about using the source code or working with mojoPortal in Visual Studio, please post in the Developer forum.

This thread is closed to new posts. You must sign in to post in the forums.
6/27/2011 8:57:22 AM
Gravatar
Total Posts 16

Problems getting Dev copy working with Visual Studio 2010

Hi,

I am attempting to get a working copy of MojoPortal working in a development environment, but every time I click to run it I get the error: Object cannot be cast from DBNull to other types.  

This error is on line 877 of CacheHelper.cs. I am using Visual Studio Professional and the version of MojoPortal is whatever the newest version is as I just got the source code via TortoiseHg. My connection strings should be correct, and I am using MSSQL.

Thanks for any help you can provide

Andrew

6/27/2011 9:03:48 AM
Gravatar
Total Posts 18439

Re: Problems getting Dev copy working with Visual Studio 2010

It sounds like you are running it in the debugger which will stop on all errors (even errors that would be handled), but if you just click continue on each error it should redirect to the Setup page to run the database scripts which would solve the errors.

It is normal for errors to happen when the database objects have not been created or are not up to date.

You need to make sure you first rebuild the entire solution, then just click continue whenever an error happens in the debugger.

Alternatively don't even use the debugger until you need to step through code, just rebuild the solution, then right click the Default.aspx page in the root of the main web project and choose View In Browser, this will launch it in the VS Web Server without being in the debug mode so it should not stop on errors, instead the error will be handled and it will redirect to /Setup/Default.aspx to complete the installation.

Hope that helps,

Joe

 

 

6/27/2011 9:21:32 AM
Gravatar
Total Posts 16

Re: Problems getting Dev copy working with Visual Studio 2010

I tried the steps you suggested, but I get the same exact error when right clicking the Default.aspx and clicking View In Browser. The only thing I can think that could contribute to this would be that the server in the connection string being used is to connect to a database that was already set up and used successfully on a development server. If worse comes to worst I will just create a local copy of the database, but it should connect just fine.

Thanks

6/27/2011 9:25:59 AM
Gravatar
Total Posts 18439

Re: Problems getting Dev copy working with Visual Studio 2010

If you've rebuilt the entire solution, I would try manually navigating to /Setup/Default.aspx and see if that gets you going.

Best,

Joe

6/27/2011 9:32:33 AM
Gravatar
Total Posts 16

Re: Problems getting Dev copy working with Visual Studio 2010

That seems to have gotten me slightly farther. When I go to the Setup all processes run successfully, but then I get the same error when navigating to the home page.

6/27/2011 9:43:10 AM
Gravatar
Total Posts 18439

Re: Problems getting Dev copy working with Visual Studio 2010

Ok, now use the debugger to find out specifically what field is throwing this exception

6/27/2011 9:47:17 AM
Gravatar
Total Posts 16

Re: Problems getting Dev copy working with Visual Studio 2010

Line 877:     pageDetails.ExpandOnSiteMap = Convert.ToBoolean(reader["ExpandOnSiteMap"]);

 

That is the line throwing the error. When I attempt to just continue through with debugger it just throws that error again, then does nothing. From there I can navigate to Setup, but then when going back to the home page it is the same thing.

6/27/2011 9:50:09 AM
Gravatar
Total Posts 18439

Re: Problems getting Dev copy working with Visual Studio 2010

The setup script for version 2.3.6.5 should have populated that field, it has the script:

UPDATE mp_Pages
SET ExpandOnSiteMap = 1

GO
 

I guess you can run that manually on your db to get past this error.

6/27/2011 10:01:10 AM
Gravatar
Total Posts 16

Re: Problems getting Dev copy working with Visual Studio 2010

That got a bit farther. Now I got a new error: Unrecognized Guid format.

Line 969:        pageDetails.PubTeamId = new Guid(reader["PubTeamId"].ToString());

6/27/2011 10:06:10 AM
Gravatar
Total Posts 18439

Re: Problems getting Dev copy working with Visual Studio 2010

This one should have been populated by the 2.3.6.0 script which has this:

UPDATE mp_Pages
SET PubTeamId = '00000000-0000-0000-0000-000000000000'

6/27/2011 10:11:14 AM
Gravatar
Total Posts 16

Re: Problems getting Dev copy working with Visual Studio 2010

And another error: Object cannot be cast from DBNull to other types.

Line 970:    pageDetails.IncludeInChildSiteMap = Convert.ToBoolean(reader["IncludeInChildSiteMap"]);

 

When I run the Setup it says that my db is up to date at version 2.3.6.6. Is there anywhere I can obtain the scripts to just update the database to wherever it needs to be? Who knows how many more of these errors I will get and I would hate to bother you with each individual one.

Thanks

6/27/2011 10:16:59 AM
Gravatar
Total Posts 18439

Re: Problems getting Dev copy working with Visual Studio 2010

That one is also from the 2.3.6.0 script which has this:

 

UPDATE mp_Pages
SET IncludeInChildSiteMap = IncludeInSiteMap
 
from the same script my guess is you will also need this:
 
UPDATE mp_Modules
SET IsGlobal = 0
 
If you get others you can note the field and then look in the recent upgrade scripts to find where it should have been populated.
 
The scripts are at /Setup/applications/mojoportal-core/SchemaUpgradeScripts/mssql
 
If you ran these scripts successfully then I have no idea why these fragments did not work the first time.
6/27/2011 10:21:21 AM
Gravatar
Total Posts 16

Re: Problems getting Dev copy working with Visual Studio 2010

Well after running those last two updates it appears to work. I need to copy my skin over to the correct folder, but beyond that it is displaying the page correctly. Odd that just that specific update script didn't work. Either way.

Thanks

6/27/2011 10:44:06 AM
Gravatar
Total Posts 18439

Re: Problems getting Dev copy working with Visual Studio 2010

It is odd, especially because it actually did run the script since the same script is what added the columns, it just somehow didn't run the parts of the script that update the data. I know I've seen this at least once before here in the forums but on my machine the scripts work correctly and I think for most people it has worked fine otherwise we'd have a lot more reports of it. Wish I could pin down exactly why and how it happens.

Anyway, glad its working.

Best,

Joe

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