未处理 System.TypeInitializationException
Message=“ThreadContext”的类型初始值设定项引发异常。
Source=System.Windows.Forms
TypeName=ThreadContext
StackTrace:
在 System.Windows.Forms.Application.ThreadContext.FromCurrent()
在 System.Windows.Forms.WindowsFormsSynchronizationContext..ctor()
在 System.Windows.Forms.WindowsFormsSynchronizationContext.InstallIfNeeded()
在 System.Windows.Forms.Control..ctor(Boolean autoInstallSyncContext)
在 System.Windows.Forms.ScrollableControl..ctor()
在 System.Windows.Forms.ContainerControl..ctor()
在 System.Windows.Forms.Form..ctor()
在 Microsoft.VisualStudio.HostingProcess.ParkingWindow..ctor()
在 Microsoft.VisualStudio.HostingProcess.HostProc.RunParkingWindowThread()
在 System.Threading.ThreadHelper.ThreadStart_Context(Object state)
在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
在 System.Threading.ThreadHelper.ThreadStart()
InnerException: System.ArgumentOutOfRangeException
Message=加载因子需要介于 0.1 和 1.0 之间。
参数名: loadFactor
Source=mscorlib
ParamName=loadFactor
StackTrace:
在 System.Collections.Hashtable..ctor(Int32 capacity, Single loadFactor)
在 System.Windows.Forms.Application.ThreadContext..cctor()InnerException: 请问这个是什么异常?如何解决?

解决方案 »

  1.   

    ThreadContext里面有没有静态构造方法,或者自定义构造方法,一般是构造方法里面出错 了。
      

  2.   

    异常从下往上抛上的,最底层启动线程时报错表明参数超出允许范围:0.1~1.0
    在 System.Threading.ThreadHelper.ThreadStart()
    InnerException: System.ArgumentOutOfRangeException
    Message=加载因子需要介于 0.1 和 1.0 之间。
    参数名: loadFactor代码怎么写的?传值时加上check()运算