Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

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

$
0
0

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");
        }
    }
}


 

Viewing all articles
Browse latest Browse all 31927

Trending Articles



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