?
Solved

TypeInitializationException was unhandled on Windows 7 64 bit OS and VStudio 2008

Posted on 2010-11-11
6
Medium Priority
?
866 Views
Last Modified: 2012-05-10
I have a new Windows 7 64 bit OS laptop with Visual Studio 2008 .

Program is coded in C#

Everytime I debug the program it give me this error

TypeInitializationException was unhandled
The type initializer for 'ADOHelper' threw an exception.

ADOHelper is a class that I created

It errors on this line
ADOHelper dHelper = new ADOHelper();

This works on a Windows 7 32 bit OS with Visual Studio 2008, but gives out an error in the 64 bit environment.

Do I need to specify a 32 bit option and how do you do it, any suggestions will be appreciated

Thanks
First part of ADO Helper Code

using System.Data.SqlClient;
using System.Configuration;
using System.Data;
using System.Data.OleDb;
using System;
using System.Collections;
using System.Windows.Forms;
using Microsoft.Win32;
using iqcnet;
using itevtlogwrap;
using formdbwrap;


public enum CONFTYPE {CENTRAL, DEMO};
public enum RETURNVAL
{
	ERROR_ONLINEHELP_MISSING=-28,
	ERROR_INVALID_REPT_FIELD_ORDER=-27,
	ERROR_GUIFILE_SAVE=-26,
	ERROR_GUIFILE_FROMFORM=-25,
	ERROR_GUIFILE_CORRUPTED=-24,
	ERROR_GUIFILE_LOAD=-23,
	ERROR_CHARSECTION_SAVE=-22,
	ERROR_SAVE_ADDITIONAL_DATA=-21,
	ERROR_FIELDSECTION_SAVE=-20,
	ERROR_INVALID_FORMIDX=-19,
	ERROR_FORMSECTION_SAVE=-18,
	ERROR_DOCSECTION_SAVE=-17,
	ERROR_FILE_SAVE=-16,
	ERROR_FILENOTOPEN=-15,
	ERROR_FILE_CREATE_ERROR=-14,
	ERROR_FILENOTFOUND=-13,
	ERROR_IQCDISCONN=-12,
	ERROR_REGOPENCONF=-11,
	ERROR_REGNOFORMDB=-10,
	ERROR_REGNOGENAPPKEY=-9,
	ERROR_REGNOCHECKPOINT=-8,
	ERROR_IQCNOLICMANAGER=-7,
	ERROR_IQLICMGRDOWN=-6,
	ERROR_IQCLICEXCEEDS=-5,
	ERROR_IQCLICMANAGER=-4,
	ERROR_IQCSTARTUP=-3,
	ERROR_ACCESSDENIED=-2,
	ERROR_GENERAL=-1,
	SUCCESS=1
}
	public class ADOHelper
	{
		//copied
		private static string m_strEnvName = "DEFAULT";
		public const string APPNAME = "iConfigForm";
		private static string m_strLicManager;
		public static string VERSION;
		private static CONFTYPE m_enConfType = CONFTYPE.CENTRAL;
		private static CIqcNet m_iqc = null;
        private static EventLogWrap m_log;
        private static string m_strFormDBDir;

Open in new window

0
Comment
Question by:hongning2009
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 13

Expert Comment

by:AngryBinary
ID: 34116894
I would suspect that one of these packages:

using iqcnet;
using itevtlogwrap;
using formdbwrap;

... may depend on 32-bit only stuff (oddly enough, I think the Microsoft.Win32 namespace is kosher in a 64-bit environment). If you had more info on what those were, it might help bear out what the problem is. You could probably work around it by changing your build configuration to target x86 specifically, instead of "Any CPU", if that's currently the case.

You access this option via the Standard toolbar (make sure it's enabled in View > Toolbars). There's a dropdown that says "Any CPU" by default. If you don't see the x86 option in there, select the "Configuration Manager..." option. You will get a dialog with the "Active solution platform" dropdown set to "Any CPU". Select the "<New...>" option, and you will get another dialog where you just need to select "x86".
0
 

Author Comment

by:hongning2009
ID: 34122125
I already changed to x86 and it still have the same problem.  Anyway I know this libraries work because it worked on a Windows 2008 x64 server.

Anyway when I look at the details I found out that the one cause the error is iqcnet

It has this error

Could not load file or assembly 'iqcnet, Version=5.0.0.2000, Culture=neutral, PublicKeyToken=236c11700a57dbaf' or one of its dependencies. The system cannot find the file specified.":"iqcnet, Version=5.0.0.2000, Culture=neutral, PublicKeyToken=236c11700a57dbaf

I have this in the reference  and I even used gacutil tp register, but problem still occurs.

Do you have any suggestions?

Thanks
0
 
LVL 33

Expert Comment

by:Todd Gerbert
ID: 34122488
Could be you're missing an assembly that iqcnet depends on.  You can check with the documentation for that assembly, or if you have the Windows SDK you can use the IL disassembler to view the manifest of the iqcnet assembly (which will tell you the names of the assemblies it depends on).
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 

Author Comment

by:hongning2009
ID: 34220584
What is the exe file of this IL disassembler?  Any help is appreciated
0
 
LVL 33

Accepted Solution

by:
Todd Gerbert earned 1500 total points
ID: 34226211
If you've installed the Windows SDK & tools, you should find it in your Start menu.
0
 

Author Closing Comment

by:hongning2009
ID: 34259488
Not very informative
0

Featured Post

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Assume you have an outside contractor who comes in seasonally or once a week to do some work in your office, but you only want to give him access to the programs and files he needs and keep all other documents and programs private. Can you do this o…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum editing capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.
Suggested Courses

741 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question