ArgumentException when adding Entity to Collection

Posts   
 
    
Jazz
User
Posts: 63
Joined: 12-Aug-2005
# Posted on: 06-Sep-2007 22:54:30   

Hi, i'm using LLBLGen 2.5 Adapter Scenario(.NET 2.0) on SqlServer 2000. For communication via WebServices i use WriteXml and ReadXml in Compact25 mode. When I change some entities(A) properties on the client side, generate xml, send it to the webservice(Wrapped in XmlDocument) and read that xml back to write the entity to the database, everything works fine. When I try to add a new Entity to collection representing a 1:n relation I get the following Exception:

System.Web.Services.Protocols.SoapException: System.Web.Services.Protocols.SoapException: Die Anforderung konnte vom Server nicht verarbeitet werden. ---> System.ArgumentException: name cannot be of zero length.
   bei SD.LLBLGen.Pro.ORMSupportClasses.EntityFields2.get_Item(String name)
   bei SD.LLBLGen.Pro.ORMSupportClasses.EntityBase2.Xml2Entity(XmlReader reader, Dictionary`2 processedObjectIDs, List`1 nodeEntityReferences)
   bei SD.LLBLGen.Pro.ORMSupportClasses.EntityCollectionBase2`1.Xml2EntityCollection(XmlReader reader, Dictionary`2 processedObjectIDs, List`1 nodeEntityReferences)
   bei SD.LLBLGen.Pro.ORMSupportClasses.EntityCollectionBase2`1.SD.LLBLGen.Pro.ORMSupportClasses.IEntityCollectionAccess2.Xml2EntityCollection(XmlReader reader, Dictionary`2 processedObjectIDs, List`1 nodeEntityReferences)
   bei SD.LLBLGen.Pro.ORMSupportClasses.EntityBase2.Xml2Entity(XmlReader reader, Dictionary`2 processedObjectIDs, List`1 nodeEntityReferences)
   bei SD.LLBLGen.Pro.ORMSupportClasses.EntityBase2.ReadXml(XmlReader reader, XmlFormatAspect format)
   bei SD.LLBLGen.Pro.ORMSupportClasses.EntityBase2.ReadXml(String xmlData)
   bei SD.LLBLGen.Pro.ORMSupportClasses.EntityBase2.ReadXml(XmlNode node)

So in short: Changing properties of Entity A works. Adding items to A's 1:n collections doesn't work. Any clue?

Edit: Here is the _lps element of the to be added entity, maybe it helps.

      <_lps fs="VAA=" es="0">
        <dbv />
      </_lps>

Regards, André

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 07-Sep-2007 10:09:39   

We've seen a report about that empty <dbv> element before. It's a pain, because we tried to repro it but failed. THe empty <dbv> element is the cause of the problem: it should either contain an element with the DBValue of the field that was changed, or not be there at all.

The field which was changed, could you give more specifics about that (e.g. code snippets) ? Was the field null when you changed it? etc. .

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 07-Sep-2007 12:40:38   

When I add an empty entity to the set and serialize it, it indeed has a dangling <dbv/> element. This confuses the XmlReader, which expects: <dbv></dbv> OR nothing at all and reads on, skipping a lot of data.

I'll try to fix both the empty <dbv> element and also the read code so it will anticipate on this.

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 07-Sep-2007 12:54:15   

Fixed in next build (released later today)

Frans Bouma | Lead developer LLBLGen Pro
Jazz
User
Posts: 63
Joined: 12-Aug-2005
# Posted on: 07-Sep-2007 15:56:14   

Hi Otis,

thanks for your quick reply and fix.

Regards, André

Jazz
User
Posts: 63
Joined: 12-Aug-2005
# Posted on: 07-Sep-2007 19:15:23   

Just downloaded the new runtime libraries. Works like a charm.

Regards, André (really appreciating the Compact25 feature)