Code: Select all
IMachine machine = virtualBox.FindMachine("VM1");
Session session = new Session();
machine.LockMachine(session, LockType.LockType_Shared);
IConsole console = session.Console;
ISnapshot snapShot = machine.FindSnapshot("Snapshot");
IProgress snapShotProgress = console.RestoreSnapshot(snapShot);
I have tried reinstalling VirtualBox and rebooting the host with no luck. The VM works fine in the VirtualBox GUI. I can start it, stop it, and restore snapshots. If the VM is running, the C# code retrieves the console object fine, but I need to restore the snapshot while it is not running.
Why would console be null?
Nothing appears in the VBox.log file when I run the C# code. Nothing jumps out when I inspect the session and machine object properties - the session state is locked, the machine "accessible" property is 1 - I don't really know what to look for though. What else can I check?
Host: Windows Server 2008 R2 64-bit, VirtualBox 4.3.12 r93733
Guest: Windows 7 Home Premium 32-bit