I am building a module ('MyModule') in which a user can set a few parameters for a calculation job.
The calculation job is then saved to a table in the DotNetNuke database.
A windows service on my machine ('MyService') checks this table every couple of minutes and if there are any jobs to be calculated, calculates them.
In my solution file there is one project that is MyModule. In another project file (in the same solution) the windows service is implemented.
MyModule has it's own namespace. The same goes for MyService. I've got a reference from MyService to MyModule.
A JobController.vb and a JobInfo.vb class are implemented in MyModule. But I need those in MyService too. I can initialize the JobController in MyService.
Only when I try to call a method ('GetNonCalculatedJobs') it returns the following error message: "The type initializer for 'MyCompany.MyModule.DataProvider' threw an exception." (The same method works fine when it resides in MyModule.)
I don't have a clue what causes this error message. Any help is greatly appreciated!
The complete error message is:
----------------------------------------------------------------------------------
System.TypeInitializationException was unhandled by user code
Message="The type initializer for 'MyCompany.MyModule.DataProvider' threw an exception."
Source="MyCompany.MyModule"
TypeName="MyCompany.MyModule.DataProvider"
StackTrace:
at MyCompany.MyModule.DataProvider.Instance()
at MyCompany.MyModule.JobController.GetNonCalculatedJobs() in D:\DotNetNuke\DesktopModules\MyModule\Components\JobController.vb:line 107
at MyService.MyService.JobTimer_Elapsed(Object sender, ElapsedEventArgs e) in D:\DotNetNuke\DesktopModules\MyService\MyService.vb:line 34
at System.Timers.Timer.MyTimerCallback(Object state)
InnerException: System.NullReferenceException
Message="Object reference not set to an instance of an object."
Source="DotNetNuke"
StackTrace:
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 MyCompany.MyModule.DataProvider.CreateProvider() in D:\DotNetNuke\DesktopModules\MyModule\Components\DataProvider.vb:line 49
at MyCompany.MyModule.DataProvider..cctor() in D:\DotNetNuke\DesktopModules\MyModule\Components\DataProvider.vb:line 44
InnerException:
----------------------------------------------------------------------------------