ApplicationData.Current.SignalDataChanged throws an unhandled error? RRS feed

  • Question

  • Hey guys, I've been scratching my head on this one all day - Here is my code

    Dim roamingSettings As Windows.Storage.ApplicationDataContainer = Windows.Storage.ApplicationData.Current.RoamingSettings
     Protected Overrides Sub OnNavigatedTo(ByVal e As NavigationEventArgs)
            AddHandler Windows.Storage.ApplicationData.Current.DataChanged, AddressOf DataChangeHandler
        End Sub
     Private Sub DataChangeHandler(ByVal appData As Windows.Storage.ApplicationData, ByVal o As Object)
    'this is where I do the theme code, but I took it out because it is long and unnecessary.. I have tried running the code with the theme code commented out as well, so the error isn't here!
        End Sub
     Private Sub TextBlock1_Tapped(sender As Object, e As TappedRoutedEventArgs)
            roamingSettings.Values("theme") = "theme1"
    End Sub

    This is the exactly the way everyone else seems to handle roaming settings, but the ApplicationData.Current.SignalDataChanged throws an error at me every time! The setting DOES save, by the way. Anyone experience this problem before? 

    The worst part about this whole thing is that it doesn't even give any error information - It throws a live break while debugging, and then highlights the following in the App.g.i.vb file: 

            AddHandler Me.UnhandledException,
                Sub(sender As Global.System.Object, unhandledExceptionArgs As Global.Windows.UI.Xaml.UnhandledExceptionEventArgs)
                    If Global.System.Diagnostics.Debugger.IsAttached Then
                    End If
                End Sub
    #End If

    Any help would be really appreciated!

    Wednesday, July 16, 2014 3:50 PM

All replies

  • What is the unhandled exception? That's what we need to figure out.

    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.

    Wednesday, July 16, 2014 4:14 PM
  • I catch the exception and it says:

    > App1.exe!App1.App.<lambda3>(Object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs unhandledExceptionArgs) Line 63 Basic

    which is highlighting the Global.System.Diagnostics.Debugger.Break (on line 63) in the App.g.i.vb file. No other info is given ;(

    Wednesday, July 16, 2014 5:05 PM
  • hmm.. it looks like everything works fine when the DataChangeHandler Sub is completely empty, but if it contains any code at all (even copying "test" to the clipboard) it throws the break. 
    • Edited by deskplace Wednesday, July 16, 2014 5:38 PM
    Wednesday, July 16, 2014 5:37 PM
  • Sorry for all the replies, but I can also add numbers to an integer in the DataChangeHandler Sub as well.. it is only when I try to do anything (such as copy clipboard text, change a grid background, or call another function) within the Sub that I get this error
    Wednesday, July 16, 2014 5:54 PM