Quantcast
Channel: XML, System.Xml, MSXML and XmlLite forum
Viewing all articles
Browse latest Browse all 935

Error "Unable to generate a temporary class (result=1). error CS0030: Cannot convert type 'MSMQFSLoader..."

$
0
0

I have an XML file, I use XSD.exe to create a class Account.
When I tried to send a message of type class Account to MSMQ, I am getting this error:
"Unable to generate a temporary class (result=1). 
error CS0030: Cannot convert type 'MSMQFSLoader.AccountContactDetailsAddressesAddress[]' to 'MSMQFSLoader.AccountContactDetailsAddressesAddress' 
error CS0029: Cannot implicitly convert type 'MSMQFSLoader.AccountContactDetailsAddressesAddress' to 'MSMQFSLoader.AccountContactDetailsAddressesAddress[]'  "

What does the error mean, and how can I fix it ?
Thank you

This is my code:

Partial Public Class Account 
    Private accountIdField As String
    Private contactDetailsField() As AccountContactDetails
:
    Public Property AccountId() As String
        Get
            Return Me.accountIdField
        End Get
        Set
            Me.accountIdField = value
        End Set
    End Property
    Public Property ContactDetails() As AccountContactDetails()
        Get
            Return Me.contactDetailsField
        End Get
        Set
            Me.contactDetailsField = value
        End Set
    End Property

Partial Public Class AccountContactDetails   
     Private addressesField()() As AccountContactDetailsAddressesAddress
     Public Property Addresses() As AccountContactDetailsAddressesAddress()()
         Get
             Return Me.addressesField
         End Get
         Set
             Me.addressesField = value
         End Set
     End Property

Partial Public Class AccountContactDetailsAddressesAddress   
     Private line1Field As String    
     Private line2Field As String
     Public Property Line1() As String
         Get
             Return Me.line1Field
         End Get
         Set
             Me.line1Field = value
         End Set
     End Property

Dim eMsg As New System.Messaging.Message()
Dim oAccount As New Account

Dim xDoc = XElement.Load(myXMLFilePath)
For Each info As XElement In xDoc...<Addresses>
	Dim oContact As New AccountContactDetails
	Dim x As Integer = 0
        Dim o(x) As AccountContactDetailsAddressesAddress
	For Each addressInfo As XElement In info...<Address>
		Dim type As String = addressInfo...<Type>.Value
                Dim line1 As String = addressInfo...<Line1>.Value
                Dim line2 As String = addressInfo...<Line2>.Value
                o(x) = New AccountContactDetailsAddressesAddress
                o(x).Type = type
                o(x).Line1 = line1
                o(x).Line2 = line2
                x += 1
                ReDim Preserve o(x)
	Next
	oContact.Addresses = {o}
        Dim oc(0) As AccountContactDetails
        oc(0) = New AccountContactDetails
        oc(0) = oContact
        oAccount.ContactDetails = oc
Next
Try
	eMsg.Body = oAccount
        myMSMQ.Send(eMsg)  '---> ERROR HERE
Catch exc As Exception
        lblStatus.Text = "ProcessProduct - Error : " & exc.Message
Finally
End Try


Viewing all articles
Browse latest Browse all 935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>