Type Initialization Exception
Hi All
I am testing a module in 4.5.5 called "Interface". It works fine and I am trying to package it.
I have compiled the .vb files (using the command line compiler) and added the .dlls to the .dnn install file.
Everything seemed OK (files in the right place when I upload) but I now get this message...
Error: Interface is currently unavailable.
DotNetNuke.Services.Exceptions.ModuleLoadException: The type initializer for 'MheLtd.Modules.Interface.DataProvider' threw an exception. ---> System.TypeInitializationException: The type initializer for 'MheLtd.Modules.Interface.DataProvider' threw an exception. ---> System.ArgumentNullException: Value cannot be null. Parameter name: type at System.Activator.CreateInstance(Type type, Boolean nonPublic) at DotNetNuke.Framework.Reflection.CreateObject(String ObjectProviderType, String ObjectProviderName, String ObjectNamespace, String ObjectAssemblyName, Boolean UseCache) at DotNetNuke.Framework.Reflection.CreateObject(String ObjectProviderType, String ObjectNamespace, String ObjectAssemblyName) at MheLtd.Modules.Interface.DataProvider.CreateProvider() at MheLtd.Modules.Interface.DataProvider..cctor() --- End of inner exception stack trace --- at MheLtd.Modules.Interface.DataProvider.Instance() at MheLtd.Modules.Interface.InterfaceController.GetInterfaces(Int32 PortalId) at MheLtd.Modules.Interface.ListInterface.Page_Load(Object sender, EventArgs e) --- End
of inner exception stack trace ---
I have seen Michael Washington’s advice that this might be caused by upgrading a module from DNN3 to DNN4 and to change
CType(Framework.Reflection.CreateObject("data", "MyModule", "MyModule.dll"), DataProvider)
To:
CType(Framework.Reflection.CreateObject("data", "MyModule", ""), DataProvider)
But my code already says
' dynamically create provider
Private Shared Sub CreateProvider()
objProvider = CType(Framework.Reflection.CreateObject("data", "MheLtd.Modules.Interface", ""), DataProvider)
End Sub
So does anyone have any thoughts on what to do next?
Kind regards
Geoffrey