开发者

Get an error System.ArgumentNullException was unhandled, Value Cannot be null. Parameter name: activationContext

I'm getting the following exception when I try to run up my Winforms app and haven't been able to find a solution to it:

System.ArgumentNullException was unhandled
  Message=Value cannot be null.
Parameter name: activationContext
  Source=mscorlib
  ParamName=activationContext
  StackTrace:
       at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 

I've added a handler for the "unhandled error" event in the applicationevents class but it never reaches that stage开发者_Go百科 and there is no source code running that I can break into and diagnose.

The application was fine until I added a user control (nothing fancy, just a standard windows user control) and then dragged it onto a form in the app (user control and form were in the same application). The application builds and compiles without any errors or warnings but when I attempt to run it up I get the above error straight away.

Does anyone have any idea what it could be or even how I can go about investigating it? I'm a bit stumped on this one as I'm not sure how to investigate it. I removed the user control from the form and then I removed the user control from the application entirely but the error hasn't gone away. In all honesty the addition of the user control might be a red herring but the problem manifested straight after adding it.

Hope someone can help.


try unchecking the Enable clickonce security settings checkbox in the security tab of the application properties(Projects Tab -> "Project Name" Properties-> Security Tab).


Try Build -> Clean Solution instead. I don't know why this isn't done automatically during a Build, but its no good complaining


I also had this problem in VS2010 VB.NET, Thanks Rene! Unchecking project_properties.security.enable click once removed my problem

How my symptoms manifested: I had a custom user control on a form, and was forced to remove any reference to it manually inside InitializeComponent() subroutine

reason: my Winform had corrupted just after I modified the New() subroutine of my custom user control, where I changed the New() to add arg's and I didn't create a 'default' Sub New() with no arg's, as required for winform page rendering)


Just to give closure on this question the following resolved it:

Unchecked the "enable clickonce security settings" checkbox in the security tab of the application properties.

As suggested by Rene in the comments of my question.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜