A first chance exception of type 'System.TimeoutException' occurred in Vestris.VMWareLib.DLL

Jul 14, 2009 at 12:01 PM
Edited Jul 14, 2009 at 12:05 PM

"A first chance exception of type 'System.TimeoutException' occurred in Vestris.VMWareLib.DLL"

if i try 2 seconds later it works fine.

I get the error randomly....this was generated while stepping through........

// declare a virtual host
                VMWareVirtualHost virtualHost = new VMWareVirtualHost();
                // connect to a remote (VMWare ESX) virtual machine
                virtualHost.ConnectToVMWareVIServer("10.255.7.38", "administrator", "L0calPa55");
                // open an existing virtual machine
                VMWareVirtualMachine virtualMachine = virtualHost.Open("[" + txtServerLUN.Text.ToString() + "] " + this.txtServerVMX.Text.ToString() + "");
                if (virtualMachine.IsRunning == true)
                {
                    this.lblOS.Text = virtualMachine.RuntimeConfigVariables["guestOSAltName"];
                    this.lblVlan.Text = virtualMachine.RuntimeConfigVariables["ethernet0.networkName"];
                    int cpu = virtualMachine.CPUCount;
                    int ram = virtualMachine.MemorySize;
                    string ip = virtualMachine.GuestVariables["ip"];
                    
                    this.lblStatus.Text = "Running";
                    this.lblIP.Text = ip.ToString();
                    this.lblCpu.Text = cpu.ToString();
                    this.lblRam.Text = ram.ToString();
                    this.btnPowerOff.Enabled = true;
                    this.btnRDP.Enabled = true;
                }
                else
                {
                    this.dbErrorLabel.Text = "server not found or offline";
                    this.btnPowerOn.Enabled = true;
                }

 

// declare a virtual host

                VMWareVirtualHost virtualHost = new VMWareVirtualHost();

                // connect to a remote (VMWare ESX) virtual machine

                virtualHost.ConnectToVMWareVIServer("10.10.10.10", "username", "password");

                // open an existing virtual machine

                VMWareVirtualMachine virtualMachine = virtualHost.Open("[" + txtServerLUN.Text.ToString() + "] " + this.txtServerVMX.Text.ToString() + "");

                if (virtualMachine.IsRunning == true)

                {

                    this.lblOS.Text = virtualMachine.RuntimeConfigVariables["guestOSAltName"];

                    this.lblVlan.Text = virtualMachine.RuntimeConfigVariables["ethernet0.networkName"];

                    int cpu = virtualMachine.CPUCount;

                    int ram = virtualMachine.MemorySize;

                    string ip = virtualMachine.GuestVariables["ip"];

                    this.lblStatus.Text = "Running";

                    this.lblIP.Text = ip.ToString();

                    this.lblCpu.Text = cpu.ToString();

                    this.lblRam.Text = ram.ToString();

                    this.btnPowerOff.Enabled = true;

                    this.btnRDP.Enabled = true;

                }

                else

                {

                    this.dbErrorLabel.Text = "server offline";

                    this.btnPowerOn.Enabled = true;

                }

 

 

hmmm, no option to attach so here is the messagebox text:

** ERROR **: file d:/build/ob/bora-127388/bora/vim/lib/gvmomiSession.c line 1155: assertion failed:

(GVMOMI_SESSION_CONNECTED == gvmomi_session_get_state(session))

aborting

 

Coordinator
Jul 14, 2009 at 3:53 PM

You're either hitting a VixCOM bug discussed here, but this one has a work-around.

Either make sure to disconnect from the host explicitly, make your virtualHost object go out of scope and GC.Collect(), GC.WaitForPendingFinalizers() right after that, every time you create a new virtualHost object, or keep the host object (and possibly a virtualMachine object) around for the duration of your application. I would do the latter.

Jul 15, 2009 at 8:30 AM

spot on, definately doesnt like connecting to multiple vm guests.

thanks