We use COM Interop (C #) so that the VB6 application can send data to the server. After the server receives the data, the managed code will raise a DataSent event. This event is triggered only after the correlation identifier is returned to the original subscriber.
In about 1% of cases, we encountered VB6 executing a raised event, before the function that originally sent the data was completed.
Using the following code:
' InteropTester.COMEvents is the C
Dim WithEvents m_ManagedData as InteropTester.COMEvents
Private Sub send_data()
Set m_ManagedData = new COMEvents
Dim id as Integer
' send 5 to using the managed interop object '
id = m_ManagedData.SendData(5)
LogData "ID " & id & " was returned"
m_correlationIds.Add id
End Sub
Private Sub m_ManagedData_DataSent(ByVal sender as Variant, ByVal id as Integer)
LogData "Data was successfully sent to C#"
' check if the returned ID is in the m_correlationIds collection goes here'
End Sub
We can check if id with value is returned when we call m_ManagedData.SendData (5), but the logs show that m_ManagedData_DataSent is sometimes called before send_data ends.
VB6 Loop , , DataSent send_data()? DoEvents, VB6 .
.