Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all articles
Browse latest Browse all 8156

Object reference not set to an instance of an object.

$
0
0

I'm loading dll using reflection. So while invoking method "Object reference not set to an instance of an object" error occurred. My Code is :

string strAssemblypath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);
                    System.Reflection.Assembly objASM = System.Reflection.Assembly.LoadFile(strAssemblypath);
                    Type ty = objASM.GetType("MSOCBM");
                    Object obj = objASM.CreateInstance("MSOCBM");
                    System.Reflection.MethodInfo MorphosMethod = this.GetType().GetMethod("Capture");
                    object[] parametersArray = new object[] { 0, 0 };
                    MorphosMethod.Invoke(obj, parametersArray);

Error occurred on last line.

Thanks in advance !!


Viewing all articles
Browse latest Browse all 8156

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>