Visual Studio Debugger exception on launch

☆樱花仙子☆ 提交于 2019-12-10 16:55:32

问题


When launching my WinForms project (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.


回答1:


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.




回答2:


Even if this one is pretty old. For me simply cleaning the solution (Build > Clean Solution) did the Job.



来源:https://stackoverflow.com/questions/6267995/visual-studio-debugger-exception-on-launch

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!