We help IT Professionals succeed at work.

VS project I created using C# crashes on other systems with exception error 80040154

OrenRozen used Ask the Experts™

I create a small project to open the 'Select Users or Groups' dialog window.
On my system (Windows 7 x64 + VS2010) the project is working with no problems.
On other systems (server2008 x64, server2003 x86) I get an exception error.
Maybe I'm missing(?) some files?

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
anarki_jimbelSenior Developer

Probably, latest .Net version is not installed on these computers.
Could you please show what the error is?
anarki_jimbelSenior Developer

Error - I mean error message...


See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {E064BB22-22CE-4E01-BB63-10EF4058CAF9} failed due to the following error: 80040154.
   at SelectUsersOrGroups_CSharp.UsersOrGroupsFrm.btnUsersGroups_Click(Object sender, EventArgs e)
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

************** Loaded Assemblies **************
    Assembly Version:
    Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
    Assembly Version: 1.0.3829.34334
    Win32 Version: 1.0.3829.34334
    CodeBase: file:///D:/SelectUsersOrGroups_CSharp.exe
    Assembly Version:
    Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/
    Assembly Version:
    Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/
    Assembly Version:
    Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/
    Assembly Version:
    Win32 Version:
    CodeBase: file:///D:/Interop.ObjectPickerHelper2Lib.DLL

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging

For example:

    <system.windows.forms jitDebugging="true" />

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.

vs 2010 is probably using .net frame work 4.0. This would need to be installed on any other computer to run. Did you create an installer for your program, it would grab the required dll's needed to run your program on another machine. Are you using any 3rd party controls? Another way to debug this problem is to use the RegMon utility, available for free at www.sysinternals.com.  It shows you how your app uses the registry.  Run it on yours and run it on the other machine and compare the two.

My 2 primary suggestions would be .net 4.0 not on the other machine, and make an installer so it grabs the dlls needed to run the app.


- .NET 4.0 is not the problem as in Server 2008 R2 it is already installed.
- I created an installer but it didn't solve the problem.
- tried regsvr32 the .dll file but got an error that the "...entry-point DllRegisterServer was not found." BTW, I get the same error if I try to register the file on my machine where the application is working.
- regmon is no longer available and was replaced with ProcessMon. never used it and don't really know what to look for.
Problem solved.

apparently, this solution uses some C++ components that are installed by default when installing Visual Studio but not on other systems.
I created a setup file using the merge module option to add the missing modules.
installing this package on other systems deployed the missing modules.