I'm using protobuf-net lib with protobuf-net memcache provider and I'm trying to use memcache append function:
var data = new ArraySegment<byte>(Encoding.UTF8.GetBytes("appendedString"));
var result = _memcache.ExecuteStore(StoreMode.Add, key, data);
And it throws exception:
The runtime has encountered a fatal error. The address of the error was at 0x63765a43, on thread 0xd58. The error code is 0xc0000005. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack.
I've done some debug and find out place when that exception is raised:
/Meta/RuntimeTypeModel.cs: 692: ((MetaType)types[key]).Serializer.Write(value, dest);
Here value
is that ArraySegment which I want to set as value and dest
is ProtoBuf.ProtoWriter.
Is there any way to fix that error or, maybe, I'm doing something wrong. Maybe I just simply need to store not an ArraySegment, but just string and append strings to it too?