Unclear error from folder monitor program

I have a program I built a while back to monitor a list of folders the user (me in this case) defines in a UI. It emails a list of users if a file was added or changed since the last check. It’s been working for years. Just today I started getting an error about there being an error in the XML. I looked at it and nothing was missing or incorrect, so I tried clearing & reentering the inputs. Still not working.

Here’s the XML, as it stands after that failed attempt to re-enter the actual folders to watch. I tried loading the XML to the program with it like this and still got the error, so it’s something about this header. I’m probably just missing something obvious.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code><DataTable>
<xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:MainDataTable="Watched_x0020_Folders" msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="Watched_x0020_Folders">
<xs:complexType>
<xs:sequence>
<xs:element name="Folder_To_Watch" type="xs:string" minOccurs="0" />
<xs:element name="Include_Sub" type="xs:string" minOccurs="0" />
<xs:element name="File_Ext" type="xs:string" minOccurs="0" />
<xs:element name="Folder_Emails" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
<diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1" />
</DataTable>
</code>
<code><DataTable> <xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:MainDataTable="Watched_x0020_Folders" msdata:UseCurrentLocale="true"> <xs:complexType> <xs:choice minOccurs="0" maxOccurs="unbounded"> <xs:element name="Watched_x0020_Folders"> <xs:complexType> <xs:sequence> <xs:element name="Folder_To_Watch" type="xs:string" minOccurs="0" /> <xs:element name="Include_Sub" type="xs:string" minOccurs="0" /> <xs:element name="File_Ext" type="xs:string" minOccurs="0" /> <xs:element name="Folder_Emails" type="xs:string" minOccurs="0" /> </xs:sequence> </xs:complexType> </xs:element> </xs:choice> </xs:complexType> </xs:element> </xs:schema> <diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1" /> </DataTable> </code>
<DataTable>
  <xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
    <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:MainDataTable="Watched_x0020_Folders" msdata:UseCurrentLocale="true">
      <xs:complexType>
        <xs:choice minOccurs="0" maxOccurs="unbounded">
          <xs:element name="Watched_x0020_Folders">
            <xs:complexType>
              <xs:sequence>
                <xs:element name="Folder_To_Watch" type="xs:string" minOccurs="0" />
                <xs:element name="Include_Sub" type="xs:string" minOccurs="0" />
                <xs:element name="File_Ext" type="xs:string" minOccurs="0" />
                <xs:element name="Folder_Emails" type="xs:string" minOccurs="0" />
              </xs:sequence>
            </xs:complexType>
          </xs:element>
        </xs:choice>
      </xs:complexType>
    </xs:element>
  </xs:schema>
  <diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1" />
</DataTable>

The error I get is below (everything after “Error Details” are the actual error message & inner message). NOTE: I get the same error when attempting to serialize as well.

9/23/2024 2:02:28 PM – Encountered an error while performing the deserialization for Load_From_XML. Error Details: There is an error in XML document (3, 4).. Inner Exception: The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))

I found this similar issue, but I’m not sure how to understand the “row” & “column” designator when I get the error without any elements in the XML. Other XML Error question

For context the functions I am using to serialize & deserialize are utilized in another program of mine that is working fine still, so it’s highly unlikely to be a fault there. Adding the serialize & deserialize functions for context though:

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>Public Function ToXML(ByVal o As Object, ByVal FName As String, ByVal path As String, ByVal spath As String) As String
'
Dim t As String = ""
Dim xs As New System.Xml.Serialization.XmlSerializer(o.GetType)
Dim ret As String = ""
Dim ie_msg As String = ""
Try
'check that the folder path exists
If Not System.IO.Directory.Exists(path.Substring(0, spath.LastIndexOf(""))) Then
System.IO.Directory.CreateDirectory(spath.Substring(0, spath.LastIndexOf("")))
End If
Catch ex As Exception
If Not IsNothing(ex.InnerException.Message) Then
ie_msg = " Inner Exception: " & ex.InnerException.Message
End If 'else nothing to capture
ret = "Encountered an error while creating the neccesary file path. Please address the following: " & ex.Message & ie_msg
End Try
'Check if the file exists
If System.IO.File.Exists(spath) Then
Try
'Delete the existing file
System.IO.File.Delete(spath)
Catch ex As Exception
If Not IsNothing(ex.InnerException.Message) Then
ie_msg = " Inner Exception: " & ex.InnerException.Message
End If 'else nothing to capture
EL.AddErr("Encountered an error while attempting to clear the current information from the existing version of the XML file for " & FName &
". Error details: " & ex.Message & ie_msg, path)
ret = "failed to clear old XML data from the identified file"
Return ret
Exit Function
End Try
End If
'Now start writing the XML file
Try
Using xsw As New System.IO.StreamWriter(spath, True)
xs.Serialize(xsw, o)
End Using
'Next
Catch ex As Exception
If Not IsNothing(ex.InnerException.Message) Then
ie_msg = " Inner Exception: " & ex.InnerException.Message
End If 'else nothing to capture
EL.AddErr("Encountered an error while serializing the information for " & FName & ". Error Details: " & ex.Message & ie_msg, path)
ret = "failed to finish serializing the provided data"
End Try
Return ret
End Function
''' <summary>
''' Converts the XML found in the identified document into data populated on the provided object
''' </summary>
''' <param name="o">The object to be loaded with data from the XML document</param>
''' <param name="spath">The full file path to the XML document to deserialize</param>
''' <param name="FName">The name of the function requesting the deserialization</param>
''' <param name="path">The full file path to log any errors to</param>
''' <returns>A string detailing any errors that occur during the deserialization (empty on success)</returns>
''' <remarks></remarks>
Public Function FromXML(ByRef o As Object, ByVal spath As String, ByVal FName As String, ByVal path As String) As String
'
Dim ret As String = ""
Dim src As New Xml.XmlDocument
Dim xs As System.Xml.Serialization.XmlSerializer
Dim ie_msg As String = ""
Try
'Setup the serializer based on the passed in object type
xs = New System.Xml.Serialization.XmlSerializer(o.GetType)
Catch ex As Exception
If Not IsNothing(ex.InnerException.Message) Then
ie_msg = " Inner Exception: " & ex.InnerException.Message
End If 'else nothing to capture
EL.AddErr("Encountered an error while trying to setup the XML deserializer to handle creating object's of the identified type for " & FName &
". Error Details: " & ex.Message & ie_msg, path)
ret = "serializer setup failing for the identified object"
Return ret
Exit Function
End Try
Try
'Load the document
src.Load(spath)
Catch ex As Exception
If Not IsNothing(ex.InnerException.Message) Then
ie_msg = " Inner Exception: " & ex.InnerException.Message
End If 'else nothing to capture
EL.AddErr("Encountered an error loading the source XML file identified by " & FName & ". Error Details: " & ex.Message & ie_msg, path)
ret = "failure to load the source XML document"
Return ret
Exit Function
End Try
Try
'Deserialize and load the object
Using xsw As New System.IO.StreamReader(spath)
o = xs.Deserialize(xsw)
End Using
Catch ex As Exception
If Not IsNothing(ex.InnerException.Message) Then
ie_msg = " Inner Exception: " & ex.InnerException.Message
End If 'else nothing to capture
EL.AddErr("Encountered an error while performing the deserialization for " & FName & ". Error Details: " & ex.Message & ie_msg, path)
ret = "failure during actual deserialization"
End Try
Return ret
End Function
</code>
<code>Public Function ToXML(ByVal o As Object, ByVal FName As String, ByVal path As String, ByVal spath As String) As String ' Dim t As String = "" Dim xs As New System.Xml.Serialization.XmlSerializer(o.GetType) Dim ret As String = "" Dim ie_msg As String = "" Try 'check that the folder path exists If Not System.IO.Directory.Exists(path.Substring(0, spath.LastIndexOf(""))) Then System.IO.Directory.CreateDirectory(spath.Substring(0, spath.LastIndexOf(""))) End If Catch ex As Exception If Not IsNothing(ex.InnerException.Message) Then ie_msg = " Inner Exception: " & ex.InnerException.Message End If 'else nothing to capture ret = "Encountered an error while creating the neccesary file path. Please address the following: " & ex.Message & ie_msg End Try 'Check if the file exists If System.IO.File.Exists(spath) Then Try 'Delete the existing file System.IO.File.Delete(spath) Catch ex As Exception If Not IsNothing(ex.InnerException.Message) Then ie_msg = " Inner Exception: " & ex.InnerException.Message End If 'else nothing to capture EL.AddErr("Encountered an error while attempting to clear the current information from the existing version of the XML file for " & FName & ". Error details: " & ex.Message & ie_msg, path) ret = "failed to clear old XML data from the identified file" Return ret Exit Function End Try End If 'Now start writing the XML file Try Using xsw As New System.IO.StreamWriter(spath, True) xs.Serialize(xsw, o) End Using 'Next Catch ex As Exception If Not IsNothing(ex.InnerException.Message) Then ie_msg = " Inner Exception: " & ex.InnerException.Message End If 'else nothing to capture EL.AddErr("Encountered an error while serializing the information for " & FName & ". Error Details: " & ex.Message & ie_msg, path) ret = "failed to finish serializing the provided data" End Try Return ret End Function ''' <summary> ''' Converts the XML found in the identified document into data populated on the provided object ''' </summary> ''' <param name="o">The object to be loaded with data from the XML document</param> ''' <param name="spath">The full file path to the XML document to deserialize</param> ''' <param name="FName">The name of the function requesting the deserialization</param> ''' <param name="path">The full file path to log any errors to</param> ''' <returns>A string detailing any errors that occur during the deserialization (empty on success)</returns> ''' <remarks></remarks> Public Function FromXML(ByRef o As Object, ByVal spath As String, ByVal FName As String, ByVal path As String) As String ' Dim ret As String = "" Dim src As New Xml.XmlDocument Dim xs As System.Xml.Serialization.XmlSerializer Dim ie_msg As String = "" Try 'Setup the serializer based on the passed in object type xs = New System.Xml.Serialization.XmlSerializer(o.GetType) Catch ex As Exception If Not IsNothing(ex.InnerException.Message) Then ie_msg = " Inner Exception: " & ex.InnerException.Message End If 'else nothing to capture EL.AddErr("Encountered an error while trying to setup the XML deserializer to handle creating object's of the identified type for " & FName & ". Error Details: " & ex.Message & ie_msg, path) ret = "serializer setup failing for the identified object" Return ret Exit Function End Try Try 'Load the document src.Load(spath) Catch ex As Exception If Not IsNothing(ex.InnerException.Message) Then ie_msg = " Inner Exception: " & ex.InnerException.Message End If 'else nothing to capture EL.AddErr("Encountered an error loading the source XML file identified by " & FName & ". Error Details: " & ex.Message & ie_msg, path) ret = "failure to load the source XML document" Return ret Exit Function End Try Try 'Deserialize and load the object Using xsw As New System.IO.StreamReader(spath) o = xs.Deserialize(xsw) End Using Catch ex As Exception If Not IsNothing(ex.InnerException.Message) Then ie_msg = " Inner Exception: " & ex.InnerException.Message End If 'else nothing to capture EL.AddErr("Encountered an error while performing the deserialization for " & FName & ". Error Details: " & ex.Message & ie_msg, path) ret = "failure during actual deserialization" End Try Return ret End Function </code>
Public Function ToXML(ByVal o As Object, ByVal FName As String, ByVal path As String, ByVal spath As String) As String
        '
        Dim t As String = ""
        Dim xs As New System.Xml.Serialization.XmlSerializer(o.GetType)
        Dim ret As String = ""
        Dim ie_msg As String = ""

        Try
            'check that the folder path exists
            If Not System.IO.Directory.Exists(path.Substring(0, spath.LastIndexOf(""))) Then
                System.IO.Directory.CreateDirectory(spath.Substring(0, spath.LastIndexOf("")))
            End If
        Catch ex As Exception
            If Not IsNothing(ex.InnerException.Message) Then
                ie_msg = " Inner Exception: " & ex.InnerException.Message
            End If 'else nothing to capture
            ret = "Encountered an error while creating the neccesary file path. Please address the following: " & ex.Message & ie_msg
        End Try

        'Check if the file exists
        If System.IO.File.Exists(spath) Then
            Try
                'Delete the existing file
                System.IO.File.Delete(spath)
            Catch ex As Exception
                If Not IsNothing(ex.InnerException.Message) Then
                    ie_msg = " Inner Exception: " & ex.InnerException.Message
                End If 'else nothing to capture
                EL.AddErr("Encountered an error while attempting to clear the current information from the existing version of the XML file for " & FName &
                       ". Error details: " & ex.Message & ie_msg, path)
                ret = "failed to clear old XML data from the identified file"
                Return ret
                Exit Function
            End Try
        End If

        'Now start writing the XML file
        Try
            Using xsw As New System.IO.StreamWriter(spath, True)
                xs.Serialize(xsw, o)
            End Using
            'Next
        Catch ex As Exception
            If Not IsNothing(ex.InnerException.Message) Then
                ie_msg = " Inner Exception: " & ex.InnerException.Message
            End If 'else nothing to capture
            EL.AddErr("Encountered an error while serializing the information for " & FName & ". Error Details: " & ex.Message & ie_msg, path)
            ret = "failed to finish serializing the provided data"
        End Try

        Return ret
    End Function

    ''' <summary>
    ''' Converts the XML found in the identified document into data populated on the provided object
    ''' </summary>
    ''' <param name="o">The object to be loaded with data from the XML document</param>
    ''' <param name="spath">The full file path to the XML document to deserialize</param>
    ''' <param name="FName">The name of the function requesting the deserialization</param>
    ''' <param name="path">The full file path to log any errors to</param>
    ''' <returns>A string detailing any errors that occur during the deserialization (empty on success)</returns>
    ''' <remarks></remarks>
    Public Function FromXML(ByRef o As Object, ByVal spath As String, ByVal FName As String, ByVal path As String) As String
        '
        Dim ret As String = ""
        Dim src As New Xml.XmlDocument
        Dim xs As System.Xml.Serialization.XmlSerializer
        Dim ie_msg As String = ""

        Try
            'Setup the serializer based on the passed in object type
            xs = New System.Xml.Serialization.XmlSerializer(o.GetType)
        Catch ex As Exception
            If Not IsNothing(ex.InnerException.Message) Then
                ie_msg = " Inner Exception: " & ex.InnerException.Message
            End If 'else nothing to capture
            EL.AddErr("Encountered an error while trying to setup the XML deserializer to handle creating object's of the identified type for " & FName &
                   ". Error Details: " & ex.Message & ie_msg, path)
            ret = "serializer setup failing for the identified object"
            Return ret
            Exit Function
        End Try

        Try
            'Load the document
            src.Load(spath)
        Catch ex As Exception
            If Not IsNothing(ex.InnerException.Message) Then
                ie_msg = " Inner Exception: " & ex.InnerException.Message
            End If 'else nothing to capture
            EL.AddErr("Encountered an error loading the source XML file identified by " & FName & ". Error Details: " & ex.Message & ie_msg, path)
            ret = "failure to load the source XML document"
            Return ret
            Exit Function
        End Try

        Try
            'Deserialize and load the object
            Using xsw As New System.IO.StreamReader(spath)
                o = xs.Deserialize(xsw)
            End Using
        Catch ex As Exception
            If Not IsNothing(ex.InnerException.Message) Then
                ie_msg = " Inner Exception: " & ex.InnerException.Message
            End If 'else nothing to capture
            EL.AddErr("Encountered an error while performing the deserialization for " & FName & ". Error Details: " & ex.Message & ie_msg, path)
            ret = "failure during actual deserialization"
        End Try

        Return ret
    End Function

11

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật