Поделиться через


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.

Comments

  • Anonymous
    March 05, 2007
    I previously wrote about bi-directional remoting over IPC (see .Net Remoting continued and .Net Remoting

  • Anonymous
    March 05, 2007
    Installing Orcas VPC? ReadMe – Save the Base Image and all the VSMar07CTP*.* (.exe and .rar’s) files to your disk all in the same directory. Running these (e.g., Open) caused me no end of confusion, especially when it prompted me for part02 and it was on the server.

  • Anonymous
    March 07, 2007
    Where can I get the bits: If you are installing the Orcas VPC, ReadMe – Save the Base Image and all the VSMar07CTP*.* (.exe and .rar’s) files to your disk all in the same directory.  Running these (e.g., Open) caused me no end of confusion, especially when it prompted me for part02 and it was on the server.

  • Anonymous
    November 12, 2007
    Hola! I just returned from TechEd 2007 held in Barcelona, Spain. Barcelona is a beautiful city with incredible