Just wondering if anyone has some tips on how to debug this error, I have narrowed it down to a trigger issue, and although the UI gets built, when I select the fields from dropdown lists, they get passed to the TriggerConfigured sub which appears to be where the error is occuring.


The sub does not look wrong to me though, which is where I am very confused at why the error is occuring. How can I go about seeing what the deserializing error actually is, or what it is trying to write to, and receive from the database to work out how to actually fix this error.

Narrowing it down a bit has helped, but I am just now not too sure how to identify what is causing the error in the sub itself.

To clarify my approach, I have been adding console.writeline components in the various parts of the plugin to see which subs are being called, after I select the text from the dropdown box in HS3 event it does call the below trigger which should be checking for the Priority_ and Brigade_ which are also spelt the same in the BuildUI part.

What is the practice for determining what is actually going wrong as I am starting to lose my mind slightly working out how to fix this. What is more frustrating is that it was working when I had 3 fields, and I determined one field was no longer needed so I removed it, deleted all of the associated events and removed all references to it, but it still does not work

Code:
Public ReadOnly Property TriggerConfigured(ByVal TrigInfo As HomeSeerAPI.IPlugInAPI.strTrigActInfo) As Boolean
        Get
            Try

            
            Dim Configured As Boolean = False
            Dim sKey As String
            Dim UID As String
            UID = TrigInfo.UID.ToString

            If TrigInfo.TANumber = 1 Then
                Dim itemsConfigured As Integer = 0
                Dim itemsToConfigure As Integer = 2
                If Not (TrigInfo.DataIn Is Nothing) Then
                    DeSerializeObject(TrigInfo.DataIn, trigger)
                    For Each sKey In trigger.Keys
                        Select Case True
                            Case InStr(sKey, "Priority_" & UID) > 0 AndAlso trigger(sKey) <> ""
                                itemsConfigured += 1
                            Case InStr(sKey, "Brigade_" & UID) > 0 AndAlso trigger(sKey) <> ""
                                itemsConfigured += 1
                        End Select
                    Next
                    If itemsConfigured = itemsToConfigure Then Configured = True
                End If
                Return Configured

            ElseIf TrigInfo.TANumber = 2 Then
                Dim itemsConfigured As Integer = 0
                Dim itemsToConfigure As Integer = 1
                If Not (TrigInfo.DataIn Is Nothing) Then
                    DeSerializeObject(TrigInfo.DataIn, trigger)
                    For Each sKey In trigger.Keys
                        Select Case True
                            Case InStr(sKey, "Regex_" & UID) > 0 AndAlso trigger(sKey) <> ""
                                itemsConfigured += 1
                        End Select
                    Next
                    If itemsConfigured = itemsToConfigure Then Configured = True
                End If
                Return Configured
            Else
                Return "Error"
            End If

            Catch ex As Exception
                Console.WriteLine("TC Err:" & ex.Message)
            End Try

        End Get
    End Property