Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesURGENT: Cast error only on production siteURGENT: Cast error only on production site
Previous
 
Next
New Post
6/21/2014 4:36 PM
 

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/21/2014 10:18 PM
 
it's impossible to say as the error is in your custom code - typically if theres a difference between dev and production environments it's either a difference in environment (e.g. application pool pipeline type, .net version or sql version), or a difference in configuration (e.g. dev has a standard en-us case insensitive install of sql, but production uses a case or accent sensitive collation), or a difference in data (the code works in dev as some table has a value/values that is missing in production, or else the dev table has a different schema than production). In each case the simplest thing to do is verify that dev and production environments and configuration match and if they do, then get a backup of production and restore it locally and debug there.

Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
New Post
6/22/2014 8:26 AM
 

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/22/2014 3:37 PM
 
FYI nullable type support was added a while back (based on a pull request at https://github.com/dnnsoftware/Dnn.Pl... ) - unfortunately the user attached the pull to the wrong issue, and we also had to manually merge it, so the version history is a bit awkward to work out but it was changed in 7.2.1 - https://github.com/dnnsoftware/Dnn.Pl... . I don't understand why your dev would work as it's 7.2.0 though

Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
New Post
6/22/2014 4:14 PM
 

That explains it, I double checked and while I initially created by dev site at 7.2 I forgot I later ran an upgrade to 7.2.2. 

From the looks of it I think an upgrade to 7.3.x for both is the most practical solution.

 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesURGENT: Cast error only on production siteURGENT: Cast error only on production site


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.

Content Layout

Subscribe to DNN Digest

DNN Digest is our monthly email newsletter. It highlights news and content from around the DNN ecosystem, such as new modules and themes, messages from leadership, blog posts and notable tweets. Keep your finger on the pulse of the ecosystem by subscribing.  


Copyright 2017 by DNN Corp Terms of Use Privacy
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out