XML Problem from webservice

Posts   
 
    
tbelknap
User
Posts: 36
Joined: 28-Jun-2006
# Posted on: 30-Dec-2006 00:55:55   

I have a webservice where I send XML from LLBL Objects to my software application running the same object. When I try to read the xml from the webservice I am getting a assembly error.

Everything I use locally works fine. It only happens when I read in the xml from the webservice into the same type of object.

Here is the error.

System.IO.FileLoadException: Could not load file or assembly 'CREToolkit.data, Version=1.0.2554.25643, Culture=neutral, PublicKeyToken=51cd9e2929375209' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) File name: 'CREToolkit.data, Version=1.0.2554.25643, Culture=neutral, PublicKeyToken=51cd9e2929375209' at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) at System.Reflection.Assembly.Load(String assemblyString) at SD.LLBLGen.Pro.ORMSupportClasses.EntityCollectionBase21.Xml2EntityCollection(XmlNode node, Dictionary2 processedObjectIDs, List1 nodeEntityReferences) at SD.LLBLGen.Pro.ORMSupportClasses.EntityCollectionBase21.ReadXml(XmlNode node) at SD.LLBLGen.Pro.ORMSupportClasses.EntityCollectionBase2`1.ReadXml(String xmlData) at CreToolkit.UIWebRetailBuyers.LoadWorker_DoWork(Object sender, DoWorkEventArgs e) in C:\Documents and Settings\Thomas Belknap\My Documents\Visual Studio 2005\Projects\CreToolkit\UserControls\Websites\UIWebRetailBuyers.vb:line 145

=== Pre-bind state information === LOG: User = SBSOLUTIONS\Thomas Belknap LOG: DisplayName = CREToolkit.data, Version=1.0.2554.25643, Culture=neutral, PublicKeyToken=51cd9e2929375209 (Fully-specified) LOG: Appbase = filedisappointed //Cdisappointed Documents and Settings/Thomas Belknap/My Documents/Visual Studio 2005/Projects/ProfitTigerPro/ProfitTigerPro/bin/Debug/ LOG: Initial PrivatePath = NULL

Calling assembly : SD.LLBLGen.Pro.ORMSupportClasses.NET20, Version=2.0.0.0, Culture=neutral, PublicKeyToken=ca73b74ba4e3ff27.

LOG: This bind starts in default load context. LOG: No application configuration file found. LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config. LOG: Post-policy reference: CREToolkit.data, Version=1.0.2554.25643, Culture=neutral, PublicKeyToken=51cd9e2929375209 LOG: Attempting download of new URL filedisappointed //Cdisappointed Documents and Settings/Thomas Belknap/My Documents/Visual Studio 2005/Projects/ProfitTigerPro/ProfitTigerPro/bin/Debug/CREToolkit.data.DLL. WRN: Comparing the assembly name resulted in the mismatch: Revision Number ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

Thanks,

Tom

bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 30-Dec-2006 03:20:36   

Are you certain that the same version of the generated code is being referenced by the exporting and ingesting projects? Also can you post the code that is creating the xml and the code that is interpreting it?

tbelknap
User
Posts: 36
Joined: 28-Jun-2006
# Posted on: 30-Dec-2006 03:52:42   

Yes, they are the same code. That was the first thing I checked when I got this error.

Here is the write routine.

    Dim Xml As String = String.Empty

    Dim Buyers As EntityCollection(Of RetailBuyerEntity) = TigerRetailWebsite.GetRetailBuyers(Setting.GetConnection)

    If Not Buyers Is Nothing Then

        Buyers.WriteXml(XmlFormatAspect.Compact, Xml)
        Return Xml

    Else

        Return ""

    End If

Here is the read routine.

Private Buyers As New EntityCollection(Of RetailBuyerEntity)

    Dim WebService As New TigerWebBuyerService.BuyerService
    Dim URL As String

    URL = CustomerAccount.GetCustomer.GetRetailBuyerServiceURL

    If URL Is Nothing Then
        XtraMessageBox.Show("Website Address was not found.", "Website Error")
        Exit Sub
    End If


    Try

        WebService.Url = URL

        Buyers.Clear()

        Buyers.ReadXml(WebService.GetRetailBuyers)

        Me.GridControl1.DataSource = Buyers


    Catch ex As Exception

        XtraMessageBox.Show(ex.StackTrace, "Connection Error")


    Finally

        WebService = Nothing

    End Try
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 30-Dec-2006 11:51:23   

The system where the exception occurs doesn't have this assembly: CREToolkit.data, Version=1.0.2554.25643, Culture=neutral, PublicKeyToken=51cd9e2929375209

It likely has a different number. As this assembly is signed, even a new build with a new version number is considered 'different' by .NET's assembly loader code (fusion).

I'd suggest you change in the assemblyinfo of CREToolkit.data, that you change the assembly version attribute from: [assembly: AssemblyVersion("1.0..")]

to: [assembly: AssemblyVersion("1.0.0.0")]

or any other hardcoded version. And Only change it when it has to be changed, e.g. you change an interface, then bump the version number up. Otherwise you'll get a new version number every time you compile your code!

Frans Bouma | Lead developer LLBLGen Pro
tbelknap
User
Posts: 36
Joined: 28-Jun-2006
# Posted on: 30-Dec-2006 18:56:52   

That did it, thanks Otis. I knew the problem had to do with versioning from the message. I just couldn't figure it out since I was running the same code on the web server.

I need to start asking for help sooner instead of losing so much time trying to figure it out. lol

Thanks again,

Thomas