[2005] The type initializer '...' threw an exception
Hi everybody
I have a problem, which is:
My Project used to work fine until I have taken the latest version from the sourcesafe.
It gave me some errors first, but I have fixed them .. Building successfully. However, when executing, this error message pops-up to me
The type initializer 'Common.DataAccessLayer.SQLWrapper' threw an exception
This exception happens when I call function A let's say, from a (2nd project) & A calls function B let's say, from a 3rd Project
When A calls B --> Exception is triggered
Re: [2005] The type initializer '...' threw an exception
Welcome to Forums! :wave:
What are those "projects" and how exactly do you "call" (or access if you will) those function (code and syntax wise) ?
Re: [2005] The type initializer '...' threw an exception
Hi RhinoBull :)
It's like this: (Projects am using with thier hierarchy order)
- Data Access Application Block 2006 (Microsoft.Practices.EnterpriseLibrary)
- ObjectBuilder
- Common
- Data
- Common
- Chart
- ReferencesUI
In the ReferencesUI..Most of the WebForms uses this kind of code:
Code:
Private Sub Refresh()
Try
...
Dim objFiscalYear As New FiscalYear
drpFiscalYear.DataSource = objFiscalYear.GetAllFiscalYear
...
Catch ex As Exception
...
End Try
End Sub
The Order of the Projects Execution is like this:
ReferencesUI --> Chart --> Common
In details, It's executed like this:
From ReferencesUI:
Inside Account.aspx.vb:
it executes this:
objFiscalYear.GetAllFiscalYear
& then It goes to Chart:
Inside FiscalYear.vb:
it executes this:
Code:
Public Function GetAllFiscalYear() As FiscalYearCollection
Dim ConString As String
Dim FiscalYears As New FiscalYearCollection
Dim ConSettings As New Settings
ConString = ConSettings.ConnectionString
Dim FiscalYearDr As SqlDataReader = SQLWrapper.ExecuteReader(ConString, "FiscalYear_SelectAll")
...
End Function
Then a window is poped:
The type initializer 'Common.DataAccessLayer.SQLWrapper' threw an exception