C# / How to modify a variable length string ?

I'm trying to modify the value of a dataset in a HDF5 file. In HDFView, the type of this dataset is : String, length =variable, 1

This is the code C# I used :

//------------------------------

H5FileId oFileId = H5F.open(@"C:\test\TestVL.h5", H5F.OpenMode.ACC_RDWR);

H5DataSetId oDataSetId = H5D.open(oFileId, "DatasetName");

Encoding m_oEncoder = Encoding.GetEncoding("ISO-8859-1");

byte[] tBuffer = m_oEncoder.GetBytes("string to write");

H5DataTypeId oDataTypeId = H5D.getType(oDataSetId);

hvl_t[] vlArray = new hvl_t[1];

unsafe

{

vlArray[0].p = H5CrtHeap.Allocate(new IntPtr(size * sizeof(byte))).ToPointer();

vlArray[0].len = (ulong)(size * sizeof(byte));

for (int i = 0; i < size; i++)

{

((byte*)vlArray[0].p)[i] = tBuffer[i];

}

}

H5D.write(oDataSetId, oDataTypeId, new H5Array<hvl_t>(vlArray));

//------------------------------

The instruction HD5.write throw an "AccessViolationException" exception and I don't see why ?

If you can help me,

Regards

Stéphane.