Re: The RPC server is unavailable
Austin Salonen
Also, I wrote a program that mimics the erring code and added a block that kills wisptis.exe prior to setting Enabled.
The first time it runs, that process is restarted. It fails after the second time I kill the process.
Stepping through the code, I could not get it to fail consistently so I tested stalling the current thread. Then I was able to delay the error popping for several iterations (code below).
What would cause that process to exit
Test Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.Ink;
using System.Diagnostics;
namespace Tester
{
public partial class Form3 : Form
{
public Form3()
{
InitializeComponent();
AddInkBoxes();
}
private void AddInkBoxes()
{
InkOverlay overlay;
int i = 0;
try
{
while (true)
{
//Code similar to erring application code
overlay = new InkOverlay(this.Handle);
overlay.CollectionMode = CollectionMode.InkAndGesture;
overlay.SetGestureStatus(ApplicationGesture.Scratchout, true);
overlay.Gesture += new InkCollectorGestureEventHandler(overlay_Gesture);
overlay.MouseUp += new InkCollectorMouseUpEventHandler(overlay_MouseUp);
overlay.CursorDown += new InkCollectorCursorDownEventHandler(overlay_CursorDown);
//end copied code
Process[] penProcesses = Process.GetProcessesByName("wisptis");
foreach (Process p in penProcesses)
{
p.Kill();
}
/*
* ms -> successful iterations
* 1 -> 3, 2, 7
* 2 -> 3, 8, 7
* 3 -> 2, 3, 2, 2
* 4 -> 50+, 9, 9, 32
* 5 -> 33, 50+, 50+, 50+
* 6 -> 280
* 7 -> 208
* 8 -> 33
* 9 -> 455
* 10 -> 366
* 11 -> 32
* 12 -> 90, 66
* Commented out -> 1
*/
System.Threading.Thread.CurrentThread.Join(12);
overlay.Enabled = true;
i++;
Debug.WriteLine(i);
overlay.Dispose();
}
}
catch (Exception ex)
{
Debug.WriteLine(ex.ToString());
}
}
void overlay_CursorDown(object sender, InkCollectorCursorDownEventArgs e)
{
throw new Exception("The method or operation is not implemented.");
}
void overlay_MouseUp(object sender, CancelMouseEventArgs e)
{
throw new Exception("The method or operation is not implemented.");
}
void overlay_Gesture(object sender, InkCollectorGestureEventArgs e)
{
throw new Exception("The method or operation is not implemented.");
}
}
}