View Issue Details

IDProjectCategoryView StatusLast Update
0000153.NET APIImplementation Bugpublic2008-07-09 05:44
ReporterNaiem Zohrri Assigned ToRandy Armstrong  
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Summary0000153: Invalid client handle when subscribing to an invalid tag
Description

Creating a subscription to an invalid tag name that does not exist in the OPC Server , returns an invalid user handle (1) in the result object ItemResult. The ItemREsult should have the original client handle specified in the Opc.Da.Item object prior to adding it to the subscription.

Additional Information

Using the latest API as of May 23, 2007

TagsNo tags attached.

Activities

Randy Armstrong

2008-05-11 12:37

administrator   ~0000699

Can you provide more information?

I cannot find any place in the could where this error could occur.

Is it still in Build 100?

Randy Armstrong

2008-05-11 12:37

administrator   ~0000700

Can you provide more information?

I cannot find any place in the could where this error could occur.

Is it still in Build 100?

Mariusz Postol

2008-07-07 11:40

reporter   ~0000719

Last edited: 2008-07-07 11:49

The problem is in the following method:
public ItemResult[] AddItems(Item[] items)
(OpcCom.Da.Subscription.AddItems(Opc.Da.Item[]))
m_items contains only created (ResultID.Succeeded()) items.
At the end of the method there is:
lock (m_items)
{
return (ItemResult[])m_items.ApplyFilters(m_filters, results);
}
Filters are applied, but only for items added to m_items (see the following snippet from ApplyFilters)
ItemIdentifier itemID = this[result.ClientHandle];

if (itemID != null)
{
result.ItemName = ((filters & (int)ResultFilter.ItemName) != 0)?itemID.ItemName:null;
result.ItemPath = ((filters & (int)ResultFilter.ItemPath) != 0)?itemID.ItemPath:null;
result.ServerHandle = result.ClientHandle; result.ClientHandle = ((filters & (int)ResultFilter.ClientHandle) != 0)?itemID.ClientHandle:null; //if added returns correct handle.

}

I hope it helps.

Randy Armstrong

2008-07-09 05:44

administrator   ~0000722

Fixed in Build 101 by moving the client handle assignment outside of the result id success check.

// save client handle.
results[ii].ClientHandle = items[ii].ClientHandle;

// add new item table.
if (results[ii].ResultID.Succeeded())
{
lock (m_items)
{
m_items[definitions[ii].hClient] = new ItemIdentifier(results[ii]);
}

// restore internal handle.
results[ii].ClientHandle = definitions[ii].hClient;

}

Issue History

Date Modified Username Field Change
2007-05-23 20:51 Naiem Zohrri New Issue
2007-07-03 15:18 Randy Armstrong Status new => assigned
2007-07-03 15:18 Randy Armstrong Assigned To => Randy Armstrong
2007-07-03 15:19 Randy Armstrong Status assigned => acknowledged
2008-05-11 12:33 Randy Armstrong Status acknowledged => resolved
2008-05-11 12:33 Randy Armstrong Resolution open => fixed
2008-05-11 12:37 Randy Armstrong Status resolved => feedback
2008-05-11 12:37 Randy Armstrong Resolution fixed => reopened
2008-05-11 12:37 Randy Armstrong Note Added: 0000699
2008-05-11 12:37 Randy Armstrong Note Added: 0000700
2008-07-07 11:40 Mariusz Postol Note Added: 0000719
2008-07-07 11:49 Mariusz Postol Note Edited: 0000719
2008-07-09 05:44 Randy Armstrong Status feedback => resolved
2008-07-09 05:44 Randy Armstrong Resolution reopened => fixed
2008-07-09 05:44 Randy Armstrong Note Added: 0000722