Forum


HomeHomePremiumPremiumDevelopmentDevelopmentURGENT: Cast error only on production site  URGENT: Cast error only on production site
Previous
 
Next
New Post
6/21/2014 11:38 AM
 

 

I got through fixing all the null handling errors I was seeing on my dev site. Everything works great. So I bundle up the module and install it on production. Arrgh, I get:

InnerException: Invalid cast from 'System.Int16' to 'System.Nullable`1[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]'.

FileName:

FileLineNumber: 0

FileColumnNumber: 0

Method: System.Convert.DefaultToType

StackTrace:

Message: DotNetNuke.Services.Exceptions.ModuleLoadException: Invalid cast from 'System.Int16' to 'System.Nullable`1[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]'. ---> System.InvalidCastException: Invalid cast from 'System.Int16' to 'System.Nullable`1[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]'. at System.Convert.DefaultToType(IConvertible value, Type targetType, IFormatProvider provider) at System.Int16.System.IConvertible.ToType(Type type, IFormatProvider provider) at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider) at DotNetNuke.Common.Utilities.CBO.HydrateObject(Object hydratedObject, IDataReader dr) at DotNetNuke.Common.Utilities.CBO.FillObjectFromReader(Object objObject, IDataReader dr) at DotNetNuke.Common.Utilities.CBO.CreateObjectFromReader(Type objType, IDataReader dr, Boolean closeReader) at DotNetNuke.Common.Utilities.CBO.FillListFromReader(Type objType, IDataReader dr, IList objList, Boolean closeReader) at DotNetNuke.Common.Utilities.CBO.FillCollection(IDataReader dr, Type objType) at Crewstone.Modules.RaceBaseCS.Components.RaceRegistrationController.GetItem(Int32 RaceId, Int32 PortalId) at Crewstone.Modules.RaceBaseCS.RaceRegistrationView.Page_Load(Object sender, EventArgs e) --- End of inner exception stack trace -

 

No way to reproduce this on the dev site, so I'm at a loss how to fix it and that part of the prod site in now down.

 
New Post
6/22/2014 4:30 AM
 
After investigation I've found the error is specific to nullable types in a object. I can't use ihydratable because the SQL is join without a single integer key. From some googling I found comments that CBO doesn't support nullable types, and I removed them and reinstalled the module and everything works in production. Production is 7.1.1, dev is 7.2. At this point I don't know if something changed in CBO between 7.1 and 7.2, or there's something else going on.
 
New Post
6/23/2014 3:28 AM
 

Great that you found it Keith.

Thanks for the update!

Aderson

 
New Post
6/23/2014 4:35 AM
 

More info in this. The reason it works in Dev and not prod is prod is 7.1.1 and dev is 7.2.2, and handling of nullable types was added to the CBO in 7.2.1.

 
Previous
 
Next
HomeHomePremiumPremiumDevelopmentDevelopmentURGENT: Cast error only on production site  URGENT: Cast error only on production site



Try FREE
30 days money back guaranteed