Object reference not set to an instance of an object. RRS feed

  • Question

  • 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 !!

    Friday, January 10, 2014 9:15 AM


All replies