473,320 Members | 1,695 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.

'System.TypeInitializationException' occurs sometimes only

Hi,



I get this error message depending on the parameters that I enter for my constants.

"An unhandled exception of type 'System.TypeInitializationException' occurred in TEST_C_26_6_2_COPY.exe"

"Additional information: The type initializer for 'aGV' threw an exception."

The funny thing is that I only get this error message when I enter certain values for my V, K, T, BLOCKS, REPLACEMENT_MAXBLOCK, REPLACEMENT_ACTIVEBLOCKS;

For example when I enter V = 10, K = 5, T = 3, BLOCKS = 17, REPLACEMENT_MAXBLOCK = 17, REPLACEMENT_ACTIVEBLOCKS = 17

there are no problems.

Conversely, when I enter V = 9, K = 4, T = 3, BLOCKS = 25, REPLACEMENT_MAXBLOCK = 25, REPLACEMENT_ACTIVEBLOCKS = 25

I get the error message pointing to the code in my Main() for the aGV.Cov

Expand|Select|Wrap|Line Numbers
  1. for (liMiscLp = 0; liMiscLp <= aGV.BLOCKS; liMiscLp++)
  2.  
  3. {
  4.  
  5.       aGV.Cov[liMiscLp, liKLp] = liKLp;
  6.  
  7. }


These are my constants that I declare in my aGV global variables method:

Expand|Select|Wrap|Line Numbers
  1. class aGV
  2.  
  3.  
  4.  
  5. {
  6.  
  7.  
  8.  
  9. public const int V = 9; // This is v
  10.  
  11. public const int K = 4; // This is k
  12.  
  13. public const int T = 3; // This is t
  14.  
  15. public const int BLOCKS = 25;
  16.  
  17. public const int REPLACEMENT_MAXBLOCK = 25;
  18.  
  19. public const int REPLACEMENT_ACTIVEBLOCKS = 25;
  20.  
  21. public static int[,] Cov = new int[aGV.BLOCKS + 1, aGV.NOCOLUMNS];
  22.  
  23. public static int[,] PCov = new int[aGV.BLOCKS + 1, aGV.NOCOLUMNS];
  24.  
  25. public static int[,] OCov = new int[aGV.BLOCKS + 1, aGV.NOCOLUMNS];
  26.  
  27. }
It is as though it is not initializing the array aGV.Cov when I enter different parameters!

Any ideas why this happens only when certain parameters are entered?



TIA

Roy
Apr 9 '13 #1
0 934

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Ethan | last post by:
I made a program that works fine as long as its on my machine, but as soon as i move it to a network drive it stops working. I'm still trying to run it on my machine just from a network drive and...
1
by: sys | last post by:
I made a smart client that I purposed to offer on a web server. But when I try to run it by dint of Internet Explorer, I get the System.TypeInitializationException in the IEExec.exe thread. My...
0
by: Sagaert Johan | last post by:
this code using System; using System.Net.Sockets; namespace ConsoleApplication1 { /// <summary> /// Summary description for Class1. /// </summary>
3
by: nick | last post by:
The program runs well on Local harddisk. But it always popup the exception if I run it on Netware mapping disk. After debugger say there is no source code on the exception. Also the following error...
1
by: Maqsood Ahmed | last post by:
Hello, We have encountered a System.TypeInitializationException in our product. This exception occurs while closing the application when application called excel.Quit(). excel is an...
0
by: user | last post by:
After starting a Windows Forms Application developed with VS 2005 Prof Beta 2, built in "Release" mode, I get "An unhandled exception of type 'System.TypeInitializationException' " When...
0
by: AG | last post by:
Hi, I have implemented the ASP.Net Ihttphandler interface. Handler references the mixed dll (both managed/unmanaged code) that contains core C++ classes wrapped under managed c++ wrappers....
7
by: RobKinney1 | last post by:
Hello, Wow...I have one for you all and hopefully I am not understanding this timer object correctly. I have a timer setup that pulses a connection through a socket every 60 seconds. But it...
1
by: madankarmukta | last post by:
Hi all, I am getting the error "The type initializer for "MyExeName.LibraryName" threw an exception." where liraryName Class have the Static constructor and the private...
0
by: =?Utf-8?B?TWFyY3VzIFNjaGFlZmVy?= | last post by:
Hi everybody, I'm working on my application for appr. 2 years and now suddenly I got an System.TypeInitializationException in one of my global modules. The error is thrown at the first call of a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
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...
1
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.