C# 启动时出现Visual Studio调试器异常
启动我的WinForms项目(项目仅包含一个源文件Program.cs)时,调试器在以下异常中中断,没有堆栈跟踪:C# 启动时出现Visual Studio调试器异常,c#,winforms,nullreferenceexception,C#,Winforms,Nullreferenceexception,启动我的WinForms项目(项目仅包含一个源文件Program.cs)时,调试器在以下异常中中断,没有堆栈跟踪: System.ArgumentNullException was unhandled Message="Value cannot be null.\r\nParameter name: activationContext" Source="mscorlib" ParamName="activationContext" StackTrace: at System.Runtime
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:
这个异常是在输入Main()函数之前抛出的,所以我不知道如何修复它
这是在Visual C#2008中。该项目已设置为ClickOnce发布。您是否尝试过在不使用VS托管进程的情况下调试应用程序?
这似乎是VS本身的错误。转到应用程序的属性,取消选中“调试”选项卡中的“启用Visual Studio托管进程”。即使此进程非常旧。对我来说,只是简单地清理解决方案(构建>清理解决方案)就完成了任务。事件日志中有任何信息吗?对不起,事件日志?不知道那是什么。VS中的输出窗口看起来包含正常内容。只是加载程序集。对不起,我指的是事件查看器。Windows->Start->Run->eventvwr.msc您是否尝试禁用visual studio宿主进程?这是项目调试设置。请检查