[Mono-list] Seemingly impossible null reference exception running managed code with embedded Mono on Linux

Jean-Michel.Perraud at csiro.au Jean-Michel.Perraud at csiro.au
Tue Mar 12 02:27:44 UTC 2013


Hi,

I am baffled by a couple of bugs I noticed running Mono (embedded in R) on a Linux box.

* Issues occur on a Debian64. Occurs with Mono 2.10.8 as well as when running on a recompiled mono using the 3.0.5 tag. 
* Annoyingly, the issue disappears if I try to diagnose by attaching to the MonoDevelop soft debugger
* No issues running the same (c/c#) code with Mono 3.0.x on Windows.

I'd appreciate guru's insights/suggestions for methods to nail this fickle bug, which is a serious blocker for my purposes.

==============================
fuller repro information is at : http://r2clr.codeplex.com/workitem/47
Scenario: R ==> Embedded Mono / c code ==> C# glue code

The call from the R interpreter:
    clrGetStaticMembers(obj_or_typename='Rclr.ClrFacade')
fails if called a third time in succession. There is no side effect that could explain why.
Subsequent calls will all succeed. 

Key lines of code, where types == null seems *completely* impossible.
    Type[] types = getTypes(arguments); // Array.ConvertAll(arguments, (x => (x == null ? typeof(object) : x.GetType())))
    var method = classType.GetMethod(methodName, bindingFlags, null, types, null);

Exception thrown in the method invocation
Argument cannot be null.
Parameter name: types
  at System.Type.GetMethod (System.String name, BindingFlags bindingAttr, System.Reflection.Binder binder, CallingConventions callConvention, System.Type[] types, System.Reflection.ParameterModifier[] modifiers) [0x00000] in <filename unknown>:0 




More information about the Mono-list mailing list