简体   繁体   中英

Visual Studio Debugger exception on launch

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM