none
[XAML][WP8.1] Debugger takes me to the App.g.i.cs page sometimes! RRS feed

  • Question

  • Hello all,

    I have an issue where the debugger takes me to this [App.g.i.cs] page when I press a button control. It doesn't happen all the time which makes it hard to identify the issue. 

    namespace Scheduler
    {
    #if !DISABLE_XAML_GENERATED_MAIN
        public static class Program
        {
            [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Windows.UI.Xaml.Build.Tasks"," 4.0.0.0")]
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            static void Main(string[] args)
            {
                global::Windows.UI.Xaml.Application.Start((p) => new App());
            }
        }
    #endif
    
        partial class App : global::Windows.UI.Xaml.Application
        {
            [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Windows.UI.Xaml.Build.Tasks"," 4.0.0.0")]
            private bool _contentLoaded;
    
            [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.Windows.UI.Xaml.Build.Tasks"," 4.0.0.0")]
            [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
            public void InitializeComponent()
            {
                if (_contentLoaded)
                    return;
    
                _contentLoaded = true;
    #if DEBUG && !DISABLE_XAML_GENERATED_BINDING_DEBUG_OUTPUT
                DebugSettings.BindingFailed += (sender, args) =>
                {
                    global::System.Diagnostics.Debug.WriteLine(args.Message);
                };
    #endif
    #if DEBUG && !DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION
                UnhandledException += (sender, e) =>
                {
                    if (global::System.Diagnostics.Debugger.IsAttached) global::System.Diagnostics.Debugger.Break();
                };
    #endif
            }
        }
    }

    On this page the debugger points me to the last "if" condition. Does this say that there is something wrong with the button declaration on the XAML side?

    Please advise!


    Thanks, Sumesh

    Thursday, May 28, 2015 1:36 PM

All replies

  • I'm looking into this for Sumesh.


    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Thursday, May 28, 2015 4:29 PM
    Moderator
  • Hello Sumesh,

    StackTrace showing which line no button location issue like that ? 


    Vinoth Rajendran

    Sunday, August 9, 2015 6:54 AM
  • You have an unhandled exception in a Task somewhere.

    Go to debug>exceptions and check all exception types to break debugger when thrown.

    If this still doesn't help, you need to take it step by step and find out where the error occurs.

    Sunday, August 9, 2015 10:02 AM
  • Hi Sumesh,

    When the application breaks and points to the unhandledException, please hover the cursor on the "e" object and see if you can find the error message.


    Monday, August 10, 2015 8:04 PM