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

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

hongning2009Asked:
Who is Participating?
 
Todd GerbertIT ConsultantCommented:
If you've installed the Windows SDK & tools, you should find it in your Start menu.
0
 
AngryBinaryCommented:
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
 
hongning2009Author Commented:
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
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
Todd GerbertIT ConsultantCommented:
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
 
hongning2009Author Commented:
What is the exe file of this IL disassembler?  Any help is appreciated
0
 
hongning2009Author Commented:
Not very informative
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.