The type initializer for 'xx.xxx.DataProvider' threw an exception.
Add an Answer
Your question has been submitted and is awaiting moderation.
Thank you for reporting this content, moderators have been notified of your submission.
I have a dotnetnuke based web application and a separate web service api. Both the project consume 2 common dlls.
here is the description of dlls:
-MyCommon.dll (contains common code used by different modules, it also has dataprovider class)
-MyCommon.SqlDataProvider.dll (uses dataprovider class of myCommon.dll)
Now, my DNN based web application is able to consume the dll properly.
[b]However, with my separate web service code I get the following error.[/b]
[i]DotNetNuke.Services.Exceptions.PageLoadException: The type initializer for 'xx.xxx.DataProvider' threw an exception. ---> System.TypeInitializationException: The type initializer for 'xx.xxx.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 TypeName, String CacheKey, Boolean UseCache) 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 xx.xxx.DataProvider.CreateProvider() in E:\DNN\xxx\xxx\xxx\DataProvider.cs:line 56 at xx.xxx.DataProvider..cctor() in E:\DNN\xxx\xxx\xxx\DataProvider.cs:line 50 [/i]
here is how dataprovider CreateProvider call looks like:
[code]private static void CreateProvider()
{
objProvider = (DataProvider)Reflection.CreateObject("data", "MyDll.Common", "");
}[/code]
Also have tried putting Assembly name in CreateObject call, but that failed both the applications.
Any help would be highly appreciated.
Thanks in advance.
Adil