Search code examples
c#wpfxamlprogram-entry-pointbreakpoints

WPF Main function breakpoint isn't hitting


With an out of the box WPF application, I changed the App file build action from ApplicationDefinition to Page.

Then I created a new class file within the project :

public partial class App{
    [STAThread( )]
    [System.Diagnostics.DebuggerNonUserCode( )]
    [System.CodeDom.Compiler.GeneratedCode( "PresentationBuildTasks", "4.0.0.0" )]
    public static void Main( ){
        Console.WriteLine( "Insert Break Point Here" );
    }
}

The console is printing the line, so it's hitting the line, but the breakpoint isn't catching.

This is just a mockup since I have a more complex program with which I am having a similar issue.

Why isn't the break point catching?


Solution

  • Figured it out - It's the line

    [System.Diagnostics.DebuggerNonUserCode( )]
    

    Commenting out that line, the break points hit.