The type initializer for "Russell.Modules.CustomWear.DataAccessLayer.DataProvider" threw an exception

The type initializer for "Russell.Modules.CustomWear.DataAccessLayer.DataProvider" threw an exception

Hi

I'm coverting one of my custom Modules to 3.1
For this module i have three Modules (Just presentation layers) Using the same BLL and DAL in their own projects.

Like everyone who seems to have this problem the error seems to be in my dataprovider class

The two assemblies that the three presentation modules use are:

Russell.Modules.CustomWear.dll   and
Russell.Modules.CustomWear.SqlDataProvider.dll

The namespace for both my dataprovider class and my sqldataprovider class is:

Russell.Modules.CustomWear.DataAccessLayer

Hence my CreateObject method look like:

Private Shared Sub CreateProvider()

objProvider = CType(Framework.Reflection.CreateObject("data", _

"Russell.Modules.CustomWear.DataAccessLayer", "Russell.Modules.CustomWear"), DataProvider)

End Sub

Which to me look right, but im still getting this exception.

0
bazz
8/10/2005 3:10:43 PM
asp.net.dotnetnuke-modules 4559 articles. 0 followers. Follow

11 Replies
255 Views

Similar Articles

[PageSpeed] 38

I did some debugging where i found that in the core framework in the file "reflections.vb" The exception is throwen on this line:

' use reflection to get the type of the class
objType = Type.GetType(TypeName, True)



The typeName looks to be correct as far as i know, Any help???


in the method

Public Shared Function CreateObject(ByVal TypeName As String, ByVal CacheKey As String) As Object

Dim objObject As Object

If CacheKey = "" Then

CacheKey = TypeName

End If

' use the cache for performance

Dim objType As Type = CType(DataCache.GetCache(CacheKey), Type)

' is the type in the cache?

If objType Is Nothing Then

Try

' use reflection to get the type of the class

objType = Type.GetType(TypeName, True)

' insert the type into the cache

DataCache.SetCache(CacheKey, objType)

Catch exc As Exception

' could not load the type

LogException(exc)

End Try

End If

' dynamically create the object

Return Activator.CreateInstance(objType)

End Function

0
bazz
8/11/2005 9:58:11 AM
Can you please post what the value is in the TypeName variable and then also tell us the namespace of the module and the name of the assembly.  Then we can tell you what the problem is.

Cheers

Philip Beadle (MVP, MCAD, MCT DotNetNuke Core Team)
0
aus_nexxus
8/11/2005 10:07:57 AM
Sorry replied from the moderators page so didnt see the rest of your thread.
Cheers
Philip Beadle (MVP, MCAD, MCT DotNetNuke Core Team)
0
aus_nexxus
8/11/2005 10:11:13 AM

The only thing I cant see is the Namespace for the data provider.  Could you post that please.
Cheers


Philip Beadle (MVP, MCAD, MCT DotNetNuke Core Team)
0
aus_nexxus
8/11/2005 10:26:42 AM
Hi mate

thanks for the reply

the namespace fo the dataprovider and the sqldataprovider class is

Namespace Russell.Modules.CustomWear.DataAccessLayer

hence why the CreateProvider method is


Private Shared Sub CreateProvider()

objProvider = CType(Framework.Reflection.CreateObject("data", _

"Russell.Modules.CustomWear.DataAccessLayer", "Russell.Modules.CustomWear"), DataProvider)

The typeName Variable = "Russell.Modules.CustomWear.DataAccessLayer.SqlDataProvider, Russell.Modules.CustomWear.SqlDataProvider"

And the CacheKey Variable = "Russell.Modules.CustomWear.DataAccessLayer.dataprovider"

and it crashes on the line specified already

i have no idea why

thanks mate


-bazz

0
bazz
8/11/2005 11:39:31 AM
This is my data provider class

Public MustInherit Class DataProvider

0
bazz
8/11/2005 12:24:12 PM
this is my entire dataprovider class:

Imports System

Imports DotNetNuke

Imports Russell.Modules.CustomWear.BusinessLayerLogic

Namespace Russell.Modules.CustomWear.DataAccessLayer

Public MustInherit Class DataProvider

' singleton reference to the instantiated object

Private Shared objProvider As DataProvider = Nothing

' constructor

Shared Sub New()

CreateProvider()

End Sub

' dynamically create provider

Private Shared Sub CreateProvider()

objProvider = CType(Framework.Reflection.CreateObject("data", _

"Russell.Modules.CustomWear.DataAccessLayer", "Russell.Modules.CustomWear"), DataProvider)

End Sub

'Return the Provider

Public Shared Shadows Function Instance() As DataProvider

Return objProvider

End Function

...............................
My  Stubs here
................................

End Class

End Namespace

0
bazz
8/11/2005 1:43:49 PM
Anyone know why i'm gettings this error??

please help

-bazz
0
bazz
8/12/2005 8:27:42 AM

Still don't know what's going on. Anyone know why i'm gettings this error??

please help

-bazz

0
bazz
8/12/2005 8:28:28 AM
What is the assembly name you are building for the SqlDataProvider project
ChrisHammond.com
Engage Software
0
christoc
8/29/2005 4:24:46 AM

hi thanks for the reply

been on holidays for two weeks so sorry for the dead post.
my assembly name is "Russell.Modules.CustomWear.SqlDataProvider"

and there is no root namespace

cheers

-bazz

0
bazz
9/1/2005 9:12:30 AM
Reply:

Similar Artilces:

Module development of DNN i am facing following issue -Exception Message "The type initializer for "eradllc.maindbtest.DataProvider" threw an exception." String
 Message "The type initializer for "eradllc.maindbtest.DataProvider" threw an exception." String   in this   eradllc.maindbtest as my namespace .i found issue by inserting two string values to database.provider name is correct. it is generating from   createprovider().the dataprovider,namespace,assembly name all are correct.   pls help  NavinAbstract...

Regarding exception -Message "The type initializer for "eradllc.maindbtest.DataProvider" threw an exception." String
Hi I am facing following exception when developing a module ie,                       Message               "The type initializer for "eradllc.maindbtest.DataProvider" threw an exception."          String       .This is when I want to send two string values(textbox values with a button click)  to database. I am sending my code .my namespace is eradllc.maind...

HelloWorld tutorial: The type initializer for "DotNetNuke.Data.DataProvider" threw an exception
Hello All,I've been struggling for the last few days trying to complete the HelloWorld module tutorial from dnnJungle using DNN 3.0.13 and Visual Studio 2002.  I think this would have all been much easier if I had VS2003 (time spent converting project files, solutions files, wizard files, fixing over 300 syntax errors, installing 1.1Framework, uninstalling 1.1Framework, re-installing 1.1Framework, etc.)Anyway, I'm at the last step of the tutorial which is creating the HelloWorldOptions.ascx page and now I've hit another glitch.  When I try to open the page in designer I g...

Upgrade DNN 3.0.13 -> 3.1.0 error: The type initializer for "DotNetNuke.Data.DataProvider" threw an exception
I tested the upgrade on a test system and worked fine. But now I have published the code to upgrade the production site and receive this following error:  Server Error in '/' Application. Value cannot be null. Parameter name: type Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.ArgumentNullException: Value cannot be null. Parameter name: typeSource Error: An unhandled exception was generated during ...

Is the "Discussions" module the same as "Forum" module?
My fresh install of DNN has several modules, including a "Forum" module.  The online tour mentions a "Discussions" module, but not a forum one. Are these the same?  If so, why does my Forum module not have a "Configuration" item in the Module Actions Menu?  I can't find a way to configure the thing, or any of the other modules for  that matter.I have the same problem with the Photo Gallery module - there's no "configuration" menu item; there's a Module Settings item, but that only lets me configure permissions, header, footer, colors, etc. Any ideas?  I'm loggin...

Type Initializer for "System.Net.IpAddress" threw an exception
Apologies - I posted this in the GD forum by mistake instead of here... .... System: Windows XP Professional The other day I had a perfect working copy of Web Matrix on which I am developing an MS SQL based package. Then,  two things happened. The first is that my Outlook 2000 Premium was reconfigured to collect and send mail via an Exchange Server as well as my normal POP3 based system.  The second is that a Blue Tooth mouse was installed. Now,  whenever I load a source file into WebMatrix and press the 'F5' key to launch the web server I get this error: "The Type...

Type Initializer for "System.Net.IpAddress" threw an exception
.... System: Windows XP Professional The other day I had a perfect working copy of Web Matrix on which I am developing an MS SQL based package. Then,  two things happened. The first is that my Outlook 2000 Premium was reconfigured to collect and send mail via an Exchange Server as well as my normal POP3 based system.  The second is that a Blue Tooth mouse was installed. Now,  whenever I load a source file into WebMatrix and press the 'F5' key to launch the web server I get this error: "The Type Initializer for 'System.Net.IpAddress' threw an exception" and the following...

"My Modules" module
Our users want to be able to customise the front page by being able to choose to add to the front page any module they have permission to view.  Are there any products which supports this?      Jonathan Palmer not too sure what you actually want but create a role called contentadmin create a user and allocate him to this role. then edit the home page and give authority to edit the page to this role now when that user logs in they will get the tab section on the top of the page and can add any modules available to that page only. They can also edit t...

System.TypeInitializationException: The type initializer for "Test.Form.DataProvider" threw an exception. --->
 Hi I am getting an exception  whenever I add a new function  or sub procedure  to   Data provider class in  a module development.  I am developing  a form module  its name as  Test.From.   The  exception  report follows   DotNetNuke.Services.Exceptions.ModuleLoadException: The type initializer for "Test.Form.DataProvider" threw an exception. ---> System.TypeInitializationException: The type initializer for "Test.Form.DataProvider" threw an exception. ---> System.ArgumentNullException: Value cannot be nul...

The type initializer for "..." threw an exception.
I am creating a custom module. when i get this error when trying to connect to the SQL Database "The type initializer for "Custom.CustomModules.DataProvider" threw an exception. I read somewhere that this should be .SQLDataProvider.  Can any one help me with this. This is usually found when either your sql dataprovider is not on the bin folder or you named it differently than what is expected (given the name you used in your dataprovider.vb code). Thanks I have solved this problem but now I am getting "Cast from string "CustomList" to type 'Integer...

Questions regarding use: "optional" modules, and "refreshing" modules
Folks, I've run into a couple of issues with use and was hoping someone could help me come up with a solution. First, I use a specific module in a work environment to set some global variables. I want to re-use my code in another environment which doesn't have the specific configuration module. I don't want to have to keep two separate copies of the code. What I currently use in the work environment is of the format: use lib '/path/to/work/modules'; use Prefs; my $config =3D Prefs->new(); my $param1 =3D $config->get("PARAM1"); I'd l...

"Random Module" Module
Hi, is there something like a "random module" module available? I mean, that with a (re)load of the current page one gets a ramdomly chosen module (text 1, alternative text2, alternative text3 for example). It should work with the standard HTML-module, but also with the NewsArticle, TextLayout, Multi Page Content modules. Cheers, DocHoliday BTW: is it just me who is experiencing that one cannot use the cursor keys inside the message edit textbox of ASP.NET forums?MCSA/MCSE on W2K3, artless DNN operator...

Unit test causes exception "The type initializer for 'XXX' threw an exception" when running code which accesses appSettings of the webconfig
I have a method which I want to unit test, the code inside that method accesses the appSetting to get the connectionString : System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"].ToString(); this piece of code works fine , but when  I m doing the unit test to test the method, the above line gives the below exception :MyMethod threw exception:  System.TypeInitializationException: The type initializer for 'XXX' threw an exception. --->  System.NullReferenceException: Object reference not set to an instance of an object..  ...

The type initializer for "TlcCorporateBase.Business.CustomerList" threw an exception
Hi, i really hope you can help me. Below is the error i'm getting. A few weird things about it: >it only happens once in a while--kind of a out of the blue thing >the underlining exception claims that the sql server does not exist or access is denied but the error happens only on this one page and not on others that also access the same sql server in the same way >the only way to get rid of the error is to reboot the machine. Please help if you can. Message: The type initializer for "TlcCorporateBase.Business.CustomerList" threw an exception....

Web resources about - The type initializer for "Russell.Modules.CustomWear.DataAccessLayer.DataProvider" threw an exception - asp.net.dotnetnuke-modules

Resources last updated: 12/26/2015 1:15:22 AM