8

I've got a WPF application that references a WPF controls library. When I try to launch (myWindow.Show()) a window that is inside the control library, I get the following exception:

InvalidDeploymentException
Application identity not set.

The bizarre thing is that I'm not doing a ClickOnce application, so why is it complaining about this?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
viggity
  • 15,039
  • 7
  • 88
  • 96

2 Answers2

21

You didn't say whether this was under the VS debugger, but...

I was getting this one today from code that set a control's ImageSource to be a BitmapImage(someURI). The code had been working perfectly, and I was puzzled until I realized that I had for other reasons just told the debugger to break on CLR exceptions. So I unchecked the System.Deployment subcategory of exceptions, and my code once again ran perfectly. Kind of a pain that MS uses the exception system internally to handle cases that I shouldn't have to care about.

vanmelle
  • 1,605
  • 1
  • 14
  • 22
  • Yeah, I think this was the problem. It is unfortunate though because it has really slowed down the app, because I'll have several hundred of these messages (they show up in the output window when debugging). – viggity Dec 16 '09 at 14:13
  • They will probably only show up when debugging. So they won't really slow down the application during normal use. – CodingBarfield Jan 18 '11 at 13:30
2

Does the window defined in the control library access the System.Deployment namespace? Do you have a stack trace that we could take a look at?

The MSDN documentation for InvalidDeploymentException states that this exception indicates that the system "could not read either the deployment or application manifests".

Some googling indicates that this exception could be raised when accessing the System.Deployment.Application.ApplicationDeployment.CurrentDeployment property, and the application is not a ClickOnce application. I suspect that for this window you are using, the controls library is accessing this property or something similar in the System.Deployment namespace.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Szymon Rozga
  • 17,971
  • 7
  • 53
  • 66