none
MethodInfo object created, but still "System.NullReferenceException"

    Question

  • Type typExternal = Type.GetType(type);
      MethodInfo methodInf = typExternal.GetMethod(method);
     290: object ret = methodInf.Invoke(o, args);


    Exception Details: System.NullReferenceException: Object reference not set to an instance of an object. (line 290)

    The problem is that there is already an instance of the object, (methodInf), but its still telling me its not an instance...

    Odd thing is that the code works flawlessly on anohter server with the same exactly config...



    Here's the stack trace..

    Stack Trace:


    [NullReferenceException: Object reference not set to an instance of an object.]
    _Default.InvokeMethod(Object o, String type, String method, Object[] args) in c:\Inetpub\supportwebsite\claims\Default.aspx.cs:290
    _Default.RaiseCallbackEvent(String eventArgument) in c:\Inetpub\supportwebsite\claims\Default.aspx.cs:270
    _Default.Page_Load(Object sender, EventArgs e) in c:\Inetpub\supportwebsite\claims\Default.aspx.cs:50
    System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
    System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +34
    System.Web.UI.Control.OnLoad(EventArgs e) +99
    System.Web.UI.Control.LoadRecursive() +47
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061




    Thanks






    Friday, May 23, 2008 6:11 PM

Answers

  • I have no idea what "_Default" is, you might be better off posting to forums.asp.net.  But consider the possibility that Mr. _Default has a catch handler that sliced off the call stack.  Meaning, the actual exception could have been raised in the method itself.  Also check that "o" isn't null, you are calling an instance method, not a static method.
    Friday, May 23, 2008 8:44 PM
    Moderator