Click here to Skip to main content
15,850,751 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Guys,

I have a problem with WPF Applications. It exits automatically. I am using VS 2010.

Steps :

1. Created new Visual Studio Solution.
2. Added new WPF Project to the solution.

Now when I try to run the application. It exists automatically and does not display any window.

But, when I take a remote connection, It displays window on remote machine.

Why am I not able to show window on simple WPF application with new solution and added new WPF project to it?

It that a problem of thread or what I am not getting it. Please help me out with this problem.
Sergey Alexandrovich Kryukov 4-May-11 2:30am    
It always works if you follow steps 1, 2. It is not clear what you do.
Sanjay J Patolia 4-May-11 2:34am    
I followed the same specified steps, though it is not working.. I think of Naming Convetion, Threads or few properties to be set. It is not working.
Sergey Alexandrovich Kryukov 4-May-11 2:39am    
OK, it means you not just added new WPF project but did something else. What you suggested for the reason of the problem looks very unlikely. What code did you add/change after the project was automatically pre-created for you? Can you post it (keep it minimal, please)?
Perry Bruins 4-May-11 4:29am    
What do you mean by "remote connection"? Default WPF projects do not have any "remote" capabilities
Sanjay J Patolia 4-May-11 4:31am    
I am using it on other machine by mstsc, working remotly, accessing my machine from other machine - A typical Windows Xp remote connection facility.

1 solution

It sounds like you have an unhandled exception going on there. In your App.xaml.cs, add an override for OnStartup and add the following line into it:
DispatcherUnhandledException += app_DispatcherUnhandledException;
Then add in the app_DispatcherUnhandledException method:
static void app_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
  // Log/inspect the inspection here
Also, check your Output window in Visual Studio. This is an excellent location for identifying issues that cause crashes, invalid bindings, etc.
Share this answer
Tarun.K.S 4-May-11 7:28am    
Good suggestion. Did learn something new.
Pete O'Hanlon 4-May-11 8:35am    
Thanks. I have this added into all my projects.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900