In C#, .NET 4.0, I am making a call to a COM DLL to return a collection object.
A foreach loop steps through each element of the collection.
In the loop, a new .NET object is created for each element of the COM collection.
The new object is added to a new .NET collection.
This works fine in the development environment.
In a deployed system, is works correctly most (about 90%) of the time.
However, sometimes (about 5% of the time) the foreach loop finds no items in the COM collection.
Other times (also about 5%), it finds the first 2 or 3 or ... N items.
Somehow, the enumeration interface exposed by the COM object is failing.
Here is a code snippet from the COM Object, which is called NameList.
NOTE that the VB6 cls file was opened in a text editor to show the class and method attributes.
VERSION 1.0 CLASS
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
Attribute VB_Name = "NameList"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Attribute VB_Ext_KEY = "SavedWithClassBuilder6" ,"Yes"
Attribute VB_Ext_KEY = "Top_Level" ,"Yes"
Private mCol As Collection
' <snip> Only code rela
View Complete Post