none
Exception has been thrown by the target of an invocation. at System.RuntimeMethodHandle.InvokeMethod RRS feed

  • Question

  • Hello,

    I am trying to invoke an assembly at a run time and receiving following error.

    Please help

    Exception has been thrown by the target of an invocation.  

    at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
       at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
       at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark)
       at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
       at System.Activator.CreateInstance(Type type, Object[] args)

    Activator.CreateInstance(Assembly.Load(configSection.threads[i].assembly).GetType(configSection.threads[i].className), new object[]
                            {
                                configSection.threads[i].startHour,
                                configSection.threads[i].startMinute,
                                configSection.threads[i].stopHour, 
                                configSection.threads[i].stopMinute, 
                                configSection.threads[i].runInterval, 
                                configSection.threads[i].trace
                            });
    
    ----------------
    
    Assembly:
    
    
    namespace MoveFile
    {
        public partial class MoveFile
        {
            public MoveFile(int startHour, int startMinute, int stopHour, int stopMinute, int runInterval, string trace)
            {
                DoWork();
            }
            public void DoWork()
            {
                EventLog.CreateEventSource("InfiniteTS", "Thread Working");
            }
        }
    }


     
    Friday, August 30, 2013 7:48 PM

Answers