i am using virtual box 5.1.26
i am developing using C# using COM. i am trying to do many actions which require to lock the VM as per my under standing for example (start monitoring, vm save state, updating cableconnected state)
i am using the following code
Code: Select all
private void btn_start_monitor_Click(object sender, EventArgs e)
{
if (m.State == MachineState.MachineState_PoweredOff|| m.State==MachineState.MachineState_Saved)
{
Session session = new VirtualBox.Session();
///this can only done if the machine is powered of
///
m.LockMachine(session, VirtualBox.LockType.LockType_Null);
INetworkAdapter NetAdapter = m.GetNetworkAdapter((uint)0);
NetAdapter.TraceEnabled = 1;
NetAdapter.TraceFile = "c:\\logs\\NTlog.pcap";
}
else
MessageBox.Show("the virtual machine " + m.Name + "must be powered of or saved first");
}
The machine is not mutable, saved or running (state is ....)
then the vm state become aborted
any advise
thanks