Class that uses System.XML throwing exception in .NET Compact Framework RRS feed

  • Question

  • I have a VS2008 solution that includes the following components:

    1. Main object classes
    2. Windows Mobile 6 application
    3. WCF service
    4. Web app
    5. Console app for testing

    My main object classes have two functions that I've written for saving/loading/transferring data to/between different areas, Function ToXML() and Sub XMLToObject(xml String).  I have tested both routines using the Console app and verified that they are functional in flipping back and forth between XML strings and the corresponding objects.

    When I use this class in the Windows Mobile 6 application, I'm having the following exception thrown when I attempt to call the .XMLToObject() sub on an object that I've instantiated and am attempting to fill out from the database XML string:

    The version of the assembly System.Xml, Version=, Culture=neutral, PublicKeyToken=B77A5C561934E089 cannot be loaded by this version of the Microsoft .NET Compact Framework.

    The mobile solution is importing System.Data and System.XML, which are both version 3.5 from the CompactFramework SDK.  Version 2.0 does not have these .dlls, so I assume this is the latest version.  I can't find any good information out there that relates to this error, so I am lost in trying to resolve this.

    Here is the relevant code:  Thanks in advance!

    Imports System.Data
    Imports AMIObjects.DataConnections
    Imports AMIObjects.getFAData
    Imports System.Data.SqlClient
    Imports System.Xml.Serialization
    Imports System.Xml
    Imports System.Data.OracleClient
    Imports System.IO
    Public Class AMI_FAObject
     Public Sub XMLToObject(ByVal sqlXML As String)
            Dim rdrFAObject As New XmlTextReader(New StringReader(sqlXML))
            rdrFAObject.WhitespaceHandling = WhitespaceHandling.None
                If rdrFAObject.Name <> "AMI_FAObject" Then
                    Throw New XmlException("Not an AMI_FAObject xml format.")
                End If
                _FA_ID = rdrFAObject.ReadElementString("fa_id")
            Catch ex As Exception
            End Try
        End Sub
    End Class

    Mobile App code file
    Imports AMIObjects
    Imports AMIObjects.AMI_FAObject
    Imports AMIObjects.AMI_Workflow
    Imports AMIObjects.AMI_Workflow_Step
    Imports System.Data
    Imports System.Xml
    Module Globals
        Public ORDER As MobileOrder()
        Public USERID As String
        Public OrderListData As DataTable
        Class MobileOrder
            Public FAObj As AMI_FAObject
            Public CompObj As AMI_WorkObject
            Public FAWorkflow As AMI_Workflow
            Public FACompWorkflow As AMI_Workflow
            Public SEQ As AMI_Workflow_Step.Seq
            Public Sub New(ByVal dr As DataRow)
                'Take datarow from AMI_Order_Mobile and convert to new ORDER class
                'FAObj property - create AMI_FAObject from XML
                Dim FAObjxml As String = dr.Item("FA_OBJECT")
                FAObj = New AMI_FAObject
                FAObj.XMLToObject(FAObjxml)   <--------- exception thrown before I can even step into the code

    • Edited by mbrowne1 Friday, April 13, 2012 1:01 PM
    Friday, April 13, 2012 1:00 PM