Solved - not triggering App_Startup

Posted on 2008-11-09
Last Modified: 2013-12-17

I'm using VS08 and I'm trying to create my own WPF application. I've moved the Main method from the generic file to my own, and am trying to run the attached code, however I'm not getting a messagebox, and the program is not shutting down. The program is starting up as the process is visible in process manager.

namespace MyApplication


    public partial class App : Application


        public static void Main()


            new App().Run();


        void App_Startup(object sender, StartupEventArgs e)







Open in new window

Question by:Unimatrix_001
    LVL 7

    Accepted Solution

    If you moved this code to a different file (than the XAML code behind) you lose the "AutoEventWireup", so you'll need to attach your event handler manualy (BTW: in this case you can remove the "partial" keyword).

            public static void Main()
                var app = new App();
                app.Statup += App_Startup;

    Open in new window

    LVL 3

    Author Closing Comment

    Thank you. :-)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
    In my previous article ( we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now