Blog Archives

Non-static method requires a target

In my specific situation where I received this error, I was able to resolve it by simply changing “null” to the object containing the method which needed to be call.

This error indicates a use of reflections that can easily be confusing, but is very simple to resolve.

The specific resolution in the (StackOverflow) example in the referenced link below did not apply to my situation, but helped me quickly understand what caused the error and come to quick resolution by simply reading through the responses.

Example code from reference below:

public static T Test<T>(MyClass myClass) where T : MyClass2, new()
{
    var result = new T();
    //...
}

For specific code example where I encountered this message and how I was able to resolve, see the snippet below or my full post Call Parent Page from User Control.

Quick comparison where I encountered the error:

if (mi!=null) mi.Invoke(null, new Object[] {sender,e }); //throws indicated error

if (mi!=null) mi.Invoke(this.Page, new Object[] {sender,e }); //runs through clean

References
“Call Parent Page from User Control”, https://ronniediaz.com/2011/07/15/call-parent-page-from-user-control/
StackOverflow, http://stackoverflow.com/questions/3577407/non-static-method-requires-a-target-in-propertyinfo-setvalue

Advertisement

Quick Cisco IOS Reference

As a general word of caution, if you have no experience with Cisco or other CLI based router admin (such as linux and red hat derivatives), I would not recommend diving in unless you have a lot of spare time on your hands in the event that you accidentally delete all routing tables or cause other serious problems!

Even in a professional business environment, due to some differences between IOS and hardware versions and the need to reboot for some settings to take effect, it’s always a good idea to perform changes after hours when critical business operations will not be interrupted by internet or service downtime.

Official Cisco IOS Manual, http://www.cisco.com/en/US/docs/ios/12_3/featlist/sec_vcg.html

Manipulate NAT and other general help references and top hits on Google for common Cisco beginner questions:
http://www.nthelp.com/handy_cisco.htm
http://www.loeppenthien.dk/Network_IOS.asp
http://www.simulationexams.com/tutorials/ccna/cisco-ios.htm
http://www.networkclue.com/routing/Cisco/IOS/index.aspx
http://www.oreillynet.com/pub/a/network/2002/01/02/ciscotips.html
http://portforward.com/english/routers/port_forwarding/Cisco/Cisco800Series/default.htm