[Mono-bugs] [Bug 471259] NullReferenceException using Reflection with valid Nullable/ByRef arguments

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sat Jan 31 10:23:28 EST 2009


https://bugzilla.novell.com/show_bug.cgi?id=471259

User joe at mistachkin.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=471259#c1





--- Comment #1 from Joe Mistachkin <joe at mistachkin.com>  2009-01-31 08:23:23 MST ---
Isolated the failure to the [object invoke $x TestByRefNullableValueTypeMethod
y] portion of the unit test which ends up calling the method
_Tests.Default.TestByRefNullableValueTypeMethod, defined as follows:

  public void TestByRefNullableValueTypeMethod(ref int? x)
  {
    if (x != null) x++;
    else x = 0;
  }

The following snippet from MarshalOps.FixupByRefArguments demonstrates the
suspected root cause of the issue:

  if (args[argumentInfo.Index] != null) // NOTE: Succeeds.
  {
      Type type = null;

      try
      {
          //
          // NOTE: NullReferenceException is thrown here, even
          //       though we just checked for null (above).
          //
          type = args[argumentInfo.Index].GetType();
      }
      catch
      {
          // do nothing.
      }

      //
      // NOTE: Variable "type" ends up being null here.
      //
  }

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list