<div dir="ltr"><div>Dear Andreas,<br></div><div>I am not sure that my code is directly usable for reference as I am using C# rather than CPP or Java which most referencing projects seem to be programmed in.</div><div><br></div>

<div>I've just been testing some simple code, and to me it looks like there is something that has broken more fundamentally in 4.3.2.</div><div><br></div><div>I keep getting exceptions (specifically  VERR_TIMEOUT) when doing simple things using a IGuestSession that works with no issues with older versions of the Guest Additions.</div>
<div><br></div><div><br></div><div>Testing now, I cannot get the VM hosting process to crash consistently with my previously described technique - it seems to do it around 1/2 of the time. Furthermore I was wrong about it being isolated to newer versions of the Guest Additions - this also happens in a snapshot that is using a pre-4.3 version of them.</div>
<div><br></div><div>I've tried to do several things with the Session, and what seems to cause the exceptions most consistently is to move a lot of files to the VM. The following code will for me crash 100% of the time:</div>
<div><br></div><div>// --------------------------------------------------</div><div>            var Vbox = new VirtualBoxClass();<br>            IMachine Machine = Vbox.FindMachine(MachineName);<br>            Session Session = new Session();<br>
<br>            Machine.LockMachine(Session, LockType.LockType_Shared);<br><br>            IGuestSession GuestSession = Session.Console.Guest.CreateSession(Username, Password, Domain, SessionName);<br><br>            GuestSession.WaitFor((uint)GuestSessionWaitForFlag.GuestSessionWaitForFlag_Start, 2000);<br>
<br>            for (int i = 0; i < 100; i++)<br>            {<br>                IProgress CopyP = GuestSession.CopyTo(SourceFile, destFile + i.ToString(), new CopyFileFlag[] { CopyFileFlag.CopyFileFlag_None });<br><br>
                while (CopyP.Completed == 0)<br>                    Thread.Sleep(0);<br>            }<br><br>            //GuestSession.Close();<br><br>            IProgress PowerDownP = Session.Console.PowerDown();<br>            while (PowerDownP.Completed == 0)<br>
                Thread.Sleep(0);<br></div><div>
// --------------------------------------------------
<br></div><div><br></div><div>And if I uncomment the GuestSession.Close the code never crashes the process. I am unfortunately not sure how C# handles the marshaller with regards to setting the GuestSession to null and how that relates to the issue. But specifically telling the marshaller to release the object (by using Marshal.FinalReleaseComObject(GuestSession)) does not help with the exception.</div>
<div><br></div>> Magnus,<br>><br>> could you please send me the code snippets of your IGuestSession / <br>
> IConsole / ISession objects, especially with regarding to object <br>> lifetime (scoping).<br>> <br>> Is IGuestSession a (static) global, and does it get properly NULLed (via <br>> "= NULL" and/or .setNull()) before calling com::Shutdown() ?<br>

> <br>> Andreas</div>