zoukankan      html  css  js  c++  java
  • 参数计数不匹配,未处理System.Reflection.TargetParameterCountException

    系统出现异常:参数计数不匹配,未处理System.Reflection.TargetParameterCountException,
    系统会显示如下的异常信息,但异常信息往往与实际异常位置差十万八千量:

    未处理 System.Reflection.TargetParameterCountException
      Message=参数计数不匹配。
      Source=mscorlib
      StackTrace:
           在 System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
           在 System.Delegate.DynamicInvokeImpl(Object[] args)
           在 System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme)
           在 System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj)
           在 System.Threading.ExecutionContext.runTryCode(Object userData)
           在 System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
           在 System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
           在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
           在 System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme)
           在 System.Windows.Forms.Control.InvokeMarshaledCallbacks()
           在 System.Windows.Forms.Control.WndProc(Message& m)
           在 System.Windows.Forms.ScrollableControl.WndProc(Message& m)
           在 System.Windows.Forms.ContainerControl.WndProc(Message& m)
           在 System.Windows.Forms.UserControl.WndProc(Message& m)
           在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
           在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
           在 System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
           在 System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
           在 System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
           在 System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
           在 System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
           在 System.Windows.Forms.Application.Run(ApplicationContext context)
           在 Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
           在 Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
           在 Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
           在 PCMax.Main.My.MyApplication.Main(String[] Args) 位置 17d14f5c-a337-4978-8281-53493378c1071.vb:行号 81
           在 System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
           在 System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
           在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
           在 System.Threading.ThreadHelper.ThreadStart_Context(Object state)
           在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
           在 System.Threading.ThreadHelper.ThreadStart()
      InnerException: 

    根据调试的实际情况显示,此异常是在使用Invoke调用时,没有正确匹配参数数量,因为Invoke或BeginInvoke方法的参数数量是可变的,所以在编译阶段根本不会出现编译错误,但在程序正式执行时,又要求目标调用方法与Delegate的方法定义必须一致,如不一致,则会出现如上异常信息。


  • 相关阅读:
    用Windows自带的命令结束进程
    spoolsv spoolsv.exe 进程信息
    Win XP打印机共享问题解决方法
    解决XP专业版局域网访问故障十八招
    取消时间限制和内存限制
    与操作
    SVN分支和合并的简单例子
    PHPExcel常用方法汇总
    python在windows下的简单搭建
    centos 6.2用yum安装中文输入法
  • 原文地址:https://www.cnblogs.com/wene/p/4668830.html
Copyright © 2011-2022 走看看