Mark,
It seems the client.ItemChanged event is throwing an exception for that channel.
Event = System.Runtime.InteropServices.COMException (0xC0040007): The item is no longer available in the server address space =0xC0040007(-1073479673)
So to give a little more detail on my code … I have the primary data retrieval function GetData() that subscribes to each client address and attaches and event handler to the client.ItemChanged event. This event handler is the client_ItemChanged() function. In my simple case to test, I just have one client address and two channels, one of those channels has special character. The code makes it through GetData() and subscribes without error, but then on the first client.ItemChanged event, I get an exception for the “special” channel as is shown above. I verified the channel label that is input into the argumentArray[] is correct. Is it possible that the dll is not able to match that channel name to what it sees on the server due to the characters, and thus returns that error?
Let me know if that code doesn’t read well in the message. I can send as attachment.
Thanks,
Jason
static void GetData()
{
var eventHandler = new EventHandler<EasyDAItemChangedEventArgs>(client_ItemChanged);
for (int j = 0; j < addressArray.Count; j++)
{
clients[j].ItemChanged += eventHandler;
}
Console.WriteLine("Subscribing item...");
int k = 0;
for(int j=0;j<addressArray.Count;j++)
{
var argumentArray = new DAItemGroupArguments[(Int16)chanCountArray[j]];
string address = (string)addressArray[j];
string hostname = address.Split(",".ToCharArray())[0];
string servername = address.Split(",".ToCharArray())[1];
for (int i = 0; i < (Int16)chanCountArray[j]; i++)
{
int requestedUpdateRate = Convert.ToInt32(scanRateCopy * 1000);
//MessageBox.Show(labelListCopy.GetValue(k).ToString());
argumentArray[i] = new DAItemGroupArguments(hostname.Trim(), servername.Trim(), labelListCopy.GetValue(k).ToString(), requestedUpdateRate, k);
k++;
}
clients[j].SubscribeMultipleItems(argumentArray);
}
while (true)
{
Thread.Sleep(1000);
if (runFlag == false) break;
}
for (int j = 0; j < addressArray.Count; j++)
{
clients[j].ItemChanged -= eventHandler;
}
}
static void client_ItemChanged(object sender, EasyDAItemChangedEventArgs e)
{
if (e.Exception != null)
{
Console.WriteLine("Event = {0}", e.Exception);
buffer[(int)e.State] = 9999.0;
}
else
{
Console.WriteLine("Event = {0}", e.Vtq.ToString());
try
{
if (e.Vtq.Quality.IsGood() == true)
{
buffer[(int)e.State] = Convert.ToDouble(e.Vtq.Value);
}
else
{
buffer[(int)e.State] = 9999.0;
}
}
catch
{
buffer[(int)e.State] = 9999.0;
}
}
}