Visual Studio Debugger exception on launch
When launching my WinForms pro开发者_StackOverflow社区ject (project only contains one source file, Program.cs), the debugger breaks with no stack trace on the following exception:
System.ArgumentNullException was unhandled
Message="Value cannot be null.\r\nParameter name: activationContext"
Source="mscorlib"
ParamName="activationContext"
StackTrace:
at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext)
at System.Activator.CreateInstance(ActivationContext activationContext)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
This exception is thrown before my Main() function is even entered, so I have no idea how to fix this.
This is in Visual C# 2008. The project is set up for ClickOnce publishing.
Have you tried debug your app without VS hosting process?
It seems that its an error of VS itself. go to your app's properties, uncheck "Enable the Visual Studio hosting process" in Debug tab.
Even if this one is pretty old. For me simply cleaning the solution (Build > Clean Solution) did the Job.
精彩评论