The error shown in the following screen shot occurs sporadically:
The application itself is in unmanaged C++, using COM objects, and .NET objects (in C# and VB) via COM interop.
Only two functions from the stack trace are in our code
McWrapperControl.ControlHost.InvokeMethod
Public Sub InvokeMethod(ByVal Member As String, ByVal NumArgs As Integer, ByVal Args As Object)
Try
Dim ArgsType As Type = Args.GetType()
Dim ArgsArray As Object
If NumArgs = 0 Then
ArgsArray = Nothing
ElseIf ArgsType.IsArray Then
ArgsArray = Args
Else
ArgsArray = {Args}
End If
InvokeMethod_ArgsArray(Member, ArgsArray)
Catch ex As Exception
ReportError.ShowErrorDialog(ex, "")
End Try
End Sub
and McWrapperControl.ControlHost.InvokeMethod_ArgsArray
Public Sub InvokeMethod_ArgsArray(ByVal Member As String, ByVal ArgsArray As Object)
Try
Dim Target As Object = ContainedControl()
If Target IsNot Nothing Then
Dim TargetType As Type = Target.GetType()
TargetType.InvokeMember(Member, BindingFlags.InvokeMethod, Nothing, Target, ArgsArray)
End If
Catch ex As MissingMethodException
'Ignore this error
Catch ex As Exception
ReportError.ShowErrorDialog(ex, "")
End Try
End Sub
In this case I am fairly certain that a MissingMethodException is occurring, but this should be caught and ignored. Obviously, I might be able to prevent this error by checking for the existence of the named method, before trying to invoke it.
Aside from that, can anybody explain what might cause this recursion?