473,320 Members | 2,088 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

The type initializer for 'MyClass' threw an exception.

Hi all,

I have this class:

Public Class KanaConverter
Private Shared kana As ArrayList
Private Shared romanji As ArrayList

Shared Sub New()
kana = New ArrayList
romanji = New ArrayList
Dim r As Data.SqlClient.SqlDataReader = japDB.getHiragana()
While r.Read()
kana.Add(r("hiragana"))
romanji.Add(r("hiragana_roman"))
End While
End Sub

Shared Function KanaToRomanji(ByVal sIn As String) As String
...
End Function
End Class

and when I do this in my page load:
Dim s As String = KanaConverter.KanaToRomanji("がくせい")
it doesn't even get to the shared constructor and throws that exception
before :
"The type initializer for 'KanaConverter' threw an exception."

What is it supposed to mean?

Feb 25 '06 #1
1 4337
ibiza <la******@gmail.com> wrote:
I have this class:
<snip>
and when I do this in my page load:
Dim s As String = KanaConverter.KanaToRomanji("????")
it doesn't even get to the shared constructor and throws that exception
before :
"The type initializer for 'KanaConverter' threw an exception."

What is it supposed to mean?


The "shared constructor" *is* the type initializer. If you catch the
TypeInitializationException, you can look at the inner exception to
find out what was wrong.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Feb 25 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Colin | last post by:
Hi there, I have wrote a simple console app in C# to get the dimensions for a jpeg file /*** Image img = Image.FromFile(@"C:\TEMP\PvFile\1036437.jpg", true); LogEvent("Height = " +...
0
by: Jonathan G. | last post by:
I'm writing my first windows service. I have a class called 'mainprocess' whose constructor is called by the service class. Within mainprocess, I declare an instance of another class I wrote,...
0
by: mm | last post by:
All I am a newbie to VB.net I define 2 classes and a module with a sub main When I run the program I get this : The type initializer for 'ExpCnv.mainModule1' threw an exception. Any idea Any...
1
by: ibiza | last post by:
Hi all, I have this class: Public Class KanaConverter Private Shared kana As ArrayList Private Shared romanji As ArrayList Shared Sub New() kana = New ArrayList
0
by: batista | last post by:
Hello All, I have windows server 2003 with IIS 6.0.. I have a webservice that is using a vc7 dll which in turn is using a com dll...now.... there is a function there in that vc7 dll that is...
0
by: Rod | last post by:
I've got Crystal Reports XI Release 2, for development with Visual Studio ..NET 2005. I've taken a VS .NET 2003 WinForms application that I wrote in C#, and upgraded it to VS .NET 2005. It has...
0
by: =?Utf-8?B?YmlqYXk=?= | last post by:
The type initializer for 'Microsoft.ApplicationBlocks.Cache.CacheService' threw an exception. We migrated our windows application from 1.1 to 2.0. The debug and Release mode of the application...
4
by: =?Utf-8?B?YmlqYXk=?= | last post by:
We migrated our windows application from 1.1 to 2.0. The debug and Release mode of the application work fine with some tweaking. But when the setup project is migrated to 2.0 the installation gives...
0
by: Schadrach | last post by:
I'm having a strange problem, I have a small executable that runs a backup for a some data nightly, and as of September 22, 2007 it has ceased to function with the following error: Unhandled...
2
by: tshad | last post by:
I got the following error message when I had set a static string value to "" or " "; "The type initializer for "theSettings" threw an exception." "The path is not of a legal form." The...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shllpp 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.