Learn More





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 ExtensionsModulesModulesOdd DAL problem, null exception...Odd DAL problem, null exception...
New Post
4/28/2014 5:46 PM

I'm still working to convert my code generation templates to DNN7  and struggling through the VB conversion. (I'm doing VB first because it was more complete than my C# version). I'm working to follow the christoc "format" as far as folder and module structure, and upgrade all the interfaces to DNN7. To start though, I just want to get everything restructured but still using DAL as DAL2 has been somewhat of a non-starter for me on functionality.

I can't seem to get anything to work in the DAL in VB. I've gotten past the various model-non-loading errors by making sure to generate all the designers and fix some namespace errors, but I'm at a loss on this error:


DotNetNuke.Services.Exceptions.PageLoadException: Exception has been thrown by the target of an invocation. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: The type initializer for 'Crewstone.Modules.Race2012VB.Data.DataProvider' threw an exception. ---> System.ArgumentNullException: Value cannot be null.

Parameter name: type

   at System.Activator.CreateInstance(Type type, Boolean nonPublic)

   at System.Activator.CreateInstance(Type type)

   at DotNetNuke.Framework.Reflection.CreateObject(String ObjectProviderType, String ObjectProviderName, String ObjectNamespace, String ObjectAssemblyName, Boolean UseCache, Boolean fixAssemblyName)

   at DotNetNuke.Framework.Reflection.CreateObject(String ObjectProviderType, String ObjectNamespace, String ObjectAssemblyName)

   at Crewstone.Modules.Race2012VB.Data.DataProvider.CreateProvider() in C:\Users\Keith Stone.CREWSTONE\Documents\My Web Sites\DNN720\DesktopModules\Race2012VB\Data\DataProvider.vb:line 43

   at Crewstone.Modules.Race2012VB.Data.DataProvider..cctor() in C:\Users\Keith Stone.CREWSTONE\Documents\My Web Sites\DNN720\DesktopModules\Race2012VB\Data\DataProvider.vb:line 38

   --- End of inner exception stack trace ---

   at Crewstone.Modules.Race2012VB.Components.FeatureController.ListContactTypes(Int32 portalId) in C:\Users\Keith Stone.CREWSTONE\Documents\My Web Sites\DNN720\DesktopModules\Race2012VB\Components\FeatureController.vb:line 73

The statement it punts on is:

<DataObjectMethod(DataObjectMethodType.Select)> _

Public Function ListContactTypes(ByVal portalId As Integer) As List(Of ContactTypeInfo)

Return CBO.FillCollection(Of ContactTypeInfo)(Data.Dataprovider.Instance().ListContactTypes(portalId))

End Function

I've checked the stored procedure and it works, but it looks like it never actually hits the dataprovider or SQLdataprovider. I don't see any breakpoints being hit there at all.

Anyone got any great ideas?


New Post
4/28/2014 6:17 PM

Assuming that you are following the usual DAL pattern of using reflection to dynamically instantiate your DataProvider in a static (shared in VB) method, the problem is most likely in the namespace string passed in the call to DotNetNuke.Framework.Reflection.CreateObject.

If you would like to post your code for this region of your DataProvider class, we'll take a look at it. 

Bill, WESNet Designs
Team Lead - DotNetNuke Gallery Module Project (Not Actively Being Developed)
Extensions Forge Projects . . .
Current: UserExport, ContentDeJour, ePrayer, DNN NewsTicker, By Invitation
Coming Soon: FRBO-For Rent By Owner
New Post
4/28/2014 9:18 PM

Perfect answer! The one place I forgot to change company.module.modulename to 

Works now! Thanks!

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesOdd DAL problem, null exception...Odd DAL problem, null exception...

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.
Try Evoq
For Free
Start Free Trial
a Demo
See Evoq Live
Need More Information?