J
Joshua Ellul
Hi There,
I have created a .NET class which I am using in VB.
The class basically performs a single operation in a loop and raises an
event (which is caught by the VB application).
Everything works fine, but then hours later the following error arrises (it
is very haphazard):
System.Reflection.TargetException: Object does not match target type.
at System.RuntimeType.InvokeDispMethod(String name, BindingFlags
invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32
culture, String[] namedParameters)
at System.RuntimeType.InvokeMember(String name, BindingFlags invokeAttr,
Binder binder, Object target, Object[] args, ParameterModifier[] modifiers,
CultureInfo culture, String[] namedParameters)
at System.RuntimeType.ForwardCallToInvokeMember(String memberName,
BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData&
msgData)
at XSOneWire.OneWireNetworkInterfaceEvents.DS1990ADiscovered(DS2409
sender, String DS1990AID, Byte MainAux)
at XSOneWire.OneWireNetworkInterface.ds2409_DS1990ADiscovered(DS2409
sender, String DS1990AID, Byte MainAux)
at XSOneWire.DS2409.Alarm()
at XSOneWire.OneWireNetworkInterface.CheckNextDS2409()
at XSOneWire.OneWireNetworkInterface.IBLoop()
This is the code line crashing:
if (DS1990ADiscovered != null)
{
DS1990ADiscovered(sender, DS1990AID, MainAux);
}
The event:
public event DeviceDiscoveredDelegate DeviceDiscovered;
with the delegate:
public delegate void DS1990ADiscoveredDelegate(DS2409 sender, string
DS1990AID, byte MainAux);
This is the event in vb:
Private Sub owni_DS1990ADiscovered(ByVal sender As DS2409, ByVal DS1990AID
As String, ByVal MainAux As Byte)
debug.print DS1990AID
End Sub
Now the place where it is crashing works 1,000,000 times over however all of
a sudden it crashes. Exactly the same code, exactly the same values. All I
can think of is some marshalling problem.
Is there some sort of bug in .NET that will eventually make this happen?
Notes:
- A main class is given COM descriptions for use in the vb application,
however other classes are not (these other classes are passed as objects
also)
I have created a .NET class which I am using in VB.
The class basically performs a single operation in a loop and raises an
event (which is caught by the VB application).
Everything works fine, but then hours later the following error arrises (it
is very haphazard):
System.Reflection.TargetException: Object does not match target type.
at System.RuntimeType.InvokeDispMethod(String name, BindingFlags
invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32
culture, String[] namedParameters)
at System.RuntimeType.InvokeMember(String name, BindingFlags invokeAttr,
Binder binder, Object target, Object[] args, ParameterModifier[] modifiers,
CultureInfo culture, String[] namedParameters)
at System.RuntimeType.ForwardCallToInvokeMember(String memberName,
BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData&
msgData)
at XSOneWire.OneWireNetworkInterfaceEvents.DS1990ADiscovered(DS2409
sender, String DS1990AID, Byte MainAux)
at XSOneWire.OneWireNetworkInterface.ds2409_DS1990ADiscovered(DS2409
sender, String DS1990AID, Byte MainAux)
at XSOneWire.DS2409.Alarm()
at XSOneWire.OneWireNetworkInterface.CheckNextDS2409()
at XSOneWire.OneWireNetworkInterface.IBLoop()
This is the code line crashing:
if (DS1990ADiscovered != null)
{
DS1990ADiscovered(sender, DS1990AID, MainAux);
}
The event:
public event DeviceDiscoveredDelegate DeviceDiscovered;
with the delegate:
public delegate void DS1990ADiscoveredDelegate(DS2409 sender, string
DS1990AID, byte MainAux);
This is the event in vb:
Private Sub owni_DS1990ADiscovered(ByVal sender As DS2409, ByVal DS1990AID
As String, ByVal MainAux As Byte)
debug.print DS1990AID
End Sub
Now the place where it is crashing works 1,000,000 times over however all of
a sudden it crashes. Exactly the same code, exactly the same values. All I
can think of is some marshalling problem.
Is there some sort of bug in .NET that will eventually make this happen?
Notes:
- A main class is given COM descriptions for use in the vb application,
however other classes are not (these other classes are passed as objects
also)