Secret revealed

In a previous post (Extra, Extra – Read all about it!) I mentioned an upcoming highly requested feature. Well, it’s here. Last night we released the Visual Studio, code name “Orcas” March 2007 CTP. In this release you will find a number of VS, Language, and Platform features. And the System AddIn library has a new feature. We extended Add-in activation beyond AppDomains to support activating Add-In’s out of process! I will post more on the Add-In team blog about the feature (as well as a little refactoring of the code we did) but here is a little code snippet using the calculator sample from our MSDN articles, showing how simple it is to activate an Add-In out of process and some additional control you may attain as a Host using process isolation.

AddInToken calcToken = ChooseCalculator(tokens);

//Activate the selected AddInToken in a new AppDomain sandboxed in the internet zone

//Calculator calculator = calcToken.Activate<Calculator>(AddInSecurityLevel.Internet);

AddInProcess addInProcess = new AddInProcess();

Process HostProcess = Process.GetCurrentProcess();

System.Diagnostics.Trace.WriteLine("Calc Host PID: " + HostProcess.Id.ToString());

// The Process ID is -1 (i.e., Unassigned. Not yet created until Activate)

System.Diagnostics.Trace.WriteLine("addInProcess PID: " + addInProcess.ProcessId.ToString());

Calculator calculator = calcToken.Activate<Calculator>(addInProcess, AddInSecurityLevel.FullTrust);

// Get the AddinProcess created

Process tmpAddinProcess = Process.GetProcessById(addInProcess.ProcessId);

// Constrain the process WS

tmpAddinProcess.MaxWorkingSet = (IntPtr)((long)tmpAddinProcess.MaxWorkingSet - (long)tmpAddinProcess.MinWorkingSet / 2);

Where can I get the bits?

Use the following links for step-by-step instructions on installing and using the VPC images or installable bits.