Memory access violation

Monkey Forums/Monkey Programming/Memory access violation

sereschkin(Posted 2014) [#1]
Hello guys,

maybe I've found a bug or it is too late :)

Following code:

Method Invoke:Void(index:int)
	Local ci:ClassInfo = GetClass(_classOfMetheodToInvoke)
	Local mi:MethodInfo[] = ci.GetMethods(False)
		
	For Local singleMethod:MethodInfo = Eachin mi
		If (singleMethod.Name = _methodNameToInvoke)
			Local argumentsArray:Object[] = [BoxInt(index),BoxInt(123)] ' Bug?
			DebugStop()
			singleMethod.Invoke(_classOfMetheodToInvoke,argumentsArray)
		End
	End
End


As soon as singleMethod.Invoke gets called the mav-error appears. I just can't find the problem or a solution. Other invokes, that is other signatures, work as expected. Another strange behaviour is, that these lines produces an array index out of range :

Local argumentsArray:Object[] = [BoxInt(index)] ' Bug?
DebugStop()
singleMethod.Invoke(_classOfMetheodToInvoke,argumentsArray)


I'm trying to solve this issue since 2 hours now and am a little frustrated.

EDIT: It was tool late :). It was a wrong reference for _classOfMetheodToInvoke that was passed to the method invoker. However the error raised by this constellation is not really helpful. I would expect a message like "The method you are trying to invoke does not exists in target."