I\'ve just started a new C#/WPF application and am using the NotifyIcon from the WPF Contrib project. I can start the program, add an \"Exit\" MenuItem to the NotifyIcon\'s Cont
I have had the same problem in my application. In my start up module (Startup.cs) I found that this works for me:
Process.GetCurrentProcess().Kill();
The code is as follows:
class StartUp
{
[STAThread]
public static void Main()
{
try
{
Process[] processes = new Process[6];
App app = new App();
app.InitializeComponent();
app.Run();
Process.GetCurrentProcess().Kill(); //Must add this line after app.Run!!!
}
catch (Exception e)
{
MessageBox.Show(e.Message);
}
}
This goes directly to the process causing the hang. There is no need to iterate through multiple processes.