After ~5 minutes of idle time, VSTA macro projects are unable to debug and VSTA IDE displays a “Failed to write to an IPC Port: The pipe is being closed” or similar. Second attempt produces this error message “Requested Service not found” error message dialog. Loaded add-ins do not timeout (that was fixed in .Net 3.5 SP1).
Periodically ‘Start Debugging’ manually or programmatically (DTE.Debugger.Go()) debugging the open project prevents this problem from occurring, but this not an acceptable workaround .
Steps to repro:
1) Build the ShapeAppMacroRecordingCSharp sample.
2) Run the associated setup .js file.
3) Run the ShapeAppMacroRecordingCSharp sample.
4) Launch the IDE.
5) Set a break point in the OnStartup method of the ide.
6) Debug from the IDE and confirm the break point is hit when debugging.
7) Leave the host application and IDE idle for 5 minutes or more.
8) ‘Start’ Debug from the IDE: “Failed to write to an IPC Port: The pipe is being closed” message will appear.
9) ‘Start’ Debug from the IDE again: “Requested Service not found” message will appear.
Solution:
This is a bug in the sample. The ShapeAppMacroRecordingCSharp sample should add InitializeLifetimeService() method with infinite timeout to the class VstaDesignTimeIntegration as shown below
/// <summary>
/// Provides Designtime VSTA Integration for ShapeAppCSharp.
/// </summary>
internal sealed class VstaDesignTimeIntegration : MarshalByRefObject, IExternalDebugHost
{
#region MarshalByRefObject
public override object InitializeLifetimeService()
{
return null; // Allows remoting from VS as long as we live.
}
#endregion MarshalByRefObject public override object InitializeLifetimeService()
. . .
Posted
Oct 22 2008, 04:00 PM
by
Gary