<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body class='hmmessage'>I suggest we eliminate the use if LLUUID outside of the ClientStack entirely; all conversions to and from LLUUID should be in the ClientStack endpoints. This would be a big step towards decoupling from libsl, as many project include it only because of LLUUID.<BR>
 <BR>
Now, this said, I warn you that using Guid directly will lead to a LOT of GC on Guids, as they are value types and are copied on all calls. You really want a reference-type wrapper to pass around.<BR>
 <BR>
A quick solution for this would be to actually start using 'Guid?' which is a short for Nullable<Guid> which incidentally gives us the opportunity to check for .HasValue instead of checking for Guid.Empty, which can lead to unpredictable behaviour (and vulnerabilities)<BR>
 <BR>
(Of course you need to do a test to see if Guid? actually serializes ok on mono vs .net)<BR>
 <BR>
This is also a worthy task for 0.5, and should be rather easily done, actually. Just replace 'LLUUID' with 'Guid?', revert the clientstack and start coping with the errors... ;)<BR>
 <BR>
Sincerely,<BR>
/Stefan<BR><BR>
<BLOCKQUOTE>
<HR id=EC_stopSpelling>
Date: Fri, 14 Dec 2007 01:50:06 -0500<BR>From: teravus@gmail.com<BR>To: opensim-dev@lists.berlios.de<BR>Subject: [Opensim-dev] So I decided to give this one more shot before I start chopping it up with a chainsaw.......<BR><BR>
<DIV>Hey Guys'n Gals..  </DIV>
<DIV> </DIV>
<DIV>Digging into Bug number 145 on Mantis..    I discovered profuse and prolific use of the unserializable LLUUID in inventory..    It's used *everywhere*.     </DIV>
<DIV> </DIV>
<DIV>It's no wonder inventory is spotty and error prone!</DIV>
<DIV> </DIV>
<DIV>It's used in InventoryFolderBase</DIV>
<DIV>It's used in InventoryItemBase</DIV>
<DIV>It's used in the REST calls</DIV>
<DIV>All of this data is being transferred over Grid Communications :/</DIV>
<DIV> </DIV>
<DIV>Once again, I restate that the LLUUID is no longer serializable.  It now implements the IComparable interface which is *not* serializable..   Therefore, it can 'never' be used in any grid communications, period. </DIV>
<DIV> </DIV>
<DIV>We all need to take a good look at the grid inventory service and 'fix' all uses of LLUUID.</DIV>
<DIV> </DIV>
<DIV>It's *really* easy to use a Guid instead.      </DIV>
<DIV> </DIV>
<DIV>To go from a System.Guid to a LLUUID, you instantiate a new LLUUID and pass the Guid to it's constructor.  </DIV>
<DIV>ex:</DIV>
<DIV> </DIV>
<DIV>Guid gAgentID = 'xxxxxxx-xx-x--x-x--xx';</DIV>
<DIV> </DIV>
<DIV>LLUUID AgentID = new LLUUID(gAgentID);</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>To go from a LLUUID to a guid, you use the UUID property of the LLUUID.</DIV>
<DIV>ex:</DIV>
<DIV> </DIV>
<DIV>Guid gAgentID = AgentID.UUID;</DIV>
<DIV> </DIV>
<DIV>So, given that you've got a userID LLUUID..      to get it over grid communications reliably..  you have to turn it into a Guid.</DIV>
<DIV> </DIV>
<DIV>requester.BeginPostObject<<STRONG>Guid</STRONG>>(_inventoryServerUrl + "/GetInventory/", <STRONG>userID.UUID</STRONG>);</DIV>
<DIV> </DIV>
<DIV>Then on the receiving side, </DIV>
<DIV> </DIV>
<DIV> httpServer.AddStreamHandler(<BR>                new RestDeserialisehandler<<STRONG>Guid</STRONG>, InventoryCollection>("POST", "/GetInventory/",<BR>                                                                                  m_inventoryService.GetUserInventory)); </DIV>
<DIV> </DIV>
<DIV>public InventoryCollection GetUserInventory(<STRONG>Guid userID</STRONG>)<BR>        {<BR>            InventoryCollection invCollection = new InventoryCollection();<BR>            List<InventoryFolderBase> folders; <BR>            List<InventoryItemBase> allItems;<BR>            if (TryGetUsersInventory(<STRONG>new LLUUID(userID),</STRONG> out folders, out allItems))<BR>            {<BR>                invCollection.AllItems = allItems; <BR>                invCollection.Folders = folders;<BR>                invCollection.UserID = <STRONG>new LLUUID(userID);</STRONG><BR>            }<BR>            return invCollection;<BR>        }</DIV>
<DIV> </DIV>
<DIV>Additionally, </DIV>
<DIV>Any object that encapsulates a LLUUID directly, is NOT serializable...   that means..   the objects;</DIV>
<DIV> </DIV>
<DIV>InventoyFolderBase</DIV>
<DIV>and </DIV>
<DIV>InventoryItemBase</DIV>
<DIV> </DIV>
<DIV>Are not serializable because they encapsulate LLUUIDs.  This is *bad* :D.  They cannot go over Grid Communications reliably.</DIV>
<DIV> </DIV>
<DIV>They all need to be changed to Guids, or we'll continue to have spotty inventory.</DIV>
<DIV> </DIV>
<DIV> :D</DIV>
<DIV> </DIV>
<DIV>I'm mentioning this because it's a big problem..  </DIV>
<DIV> </DIV>
<DIV>I don't really know this portion of the code well..   so if I edit it, it's likely to break..  hence the subject.</DIV>
<DIV> </DIV>
<DIV>Someone take this on please..   so I don't have to chop it up with a chainsaw..    grind it down with a tree stump grinder, run it over with a steam roller and jack-hammer it to itty bitty bite sized serializable components that can reliably be transferred over grid communications. :D </DIV>
<DIV> </DIV>
<DIV>Best Regards </DIV>
<DIV> </DIV>
<DIV>Tera</DIV></BLOCKQUOTE></body>
</html>