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 ContextMenu, and link that item to a method that simply runs Application.Current.Shutdown().

This closes the main window and the NotifyIcon, but something continues to run - running from VS, it does not leave debug mode. What is still running? Or how can I check?

EDIT

I've just tried adding a button that calls Application.Current.Shutdown(), and that exits properly. It's only when called from the NotifyIcon that I have a problem. Why would this be?

To clarify, I have the following XAML:

<Window x:Class="VirtualBoxManager.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:av="http://schemas.codeplex.com/wpfcontrib/xaml/presentation"
    Title="VirtualBox Manager" Height="350" Width="525"
    ShowInTaskbar="False" WindowStyle="None">
<Grid>
    <av:NotifyIcon Icon="/icon/path"
                   Text="Virtual Machine Manager"
                   Name="notifyIcon">
        <FrameworkElement.ContextMenu>
            <ContextMenu>
                <MenuItem Header="Exit" Click="MenuItemExit_Click" />
            </ContextMenu>
        </FrameworkElement.ContextMenu>
    </av:NotifyIcon>
    <Button Content="Button" Click="button1_Click" />
</Grid>

Both button1_Click and MenuItemExit_Click are identical, but the former successfully exits the app and the latter does not.

Further experimentation: even if I move Application.Current.Shutdown() into another method and call that instead, adding a layer of indirection, still the button works and the icon doesn't.

Solution fo

Edit
Report