Deserialize Error
All,
Hello! I'm a rather new developer, so please bear with me if I'm totally off track. :)
I'm trying to setup the Membase memcached server to store serialized objects that I can then grab and deserialize. I am able to store and retrieve strings from the memcached server without any problems and I have compared these two strings to verify they are, in fact, the same.
However, when I try to deserialize one of these objects, I'm consistently receiving the same error--regardless of which object I try to deserialize. Deserialization works without a hitch if I serialize and deserialize without passing the object through memcached/Membase.
Here is some psudo-code:
-----------------------------------------------------------------------------------------------
Tile one = new Tile();
Tile oneBack;
Assert.IsTrue(client.Store(StoreMode.Set, one.tileId.ToString(), one.Serialize()), "Store procedure for ONE Failed");
string oneFromCache = client.Get(one.tileId.ToString());
Assert.NotNull(oneFromCache);
Assert.AreEqual(one.Serialize(), oneFromCache.ToString());
oneBack = ClassicSerializer.Deserialize(oneFromCache.ToString(), typeof(Tile)) as Tile;
-----------------------------------------------------------------------------------------------
The crash occurs on the last line here. This is the error:
System.InvalidOperationException : There is an error in XML document (1, 2).
----> System.InvalidOperationException : was not expected.
The only thing that seems off about this is the SINGLE ( ' ) quotes before and after the data. When I print this line to console, these appear as DOUBLE quotes ( " ).
Any assistance you can provide would be wonderful,
Cheers,
Doug
I don't see why it should not work; the client does not modify the data you pass to it.
I.
Can you try the assert without the tostring?
II.
create a simple app, which does only the following:
client.Store(StoreMode.Set, one.tileId.ToString(), one.Serialize())now telnet to the memcached servers's 11211 port
c:\> telnet HOST 11211type this, then press enter:
[CODE]get PUT_THE_ITEM_ID_HERE[/CODE]
so, if one.tileId == "Tile_Id_1234", you'd type:
get Tile_Id_1234(make sure you use the DefaultKeyTransformer, so they keys will remain as-is. remove the element from your config temporarly. [URL=http://wiki.github.com/enyim/EnyimMemcached/northscaleclient-configuration]See more here.[/URL])
now, you shluld see the key's data in the telnet window. does it have the aposthropes?