After migration from Visual Studio 2012 to 2013 some PInvoke calls not working as previously.
For example, I'm struggling with this code:
Signature:
[DllImport(LzoDll64Bit)]
private static extern int lzo1x_decompress(byte[] src, int src_len, byte[] dst, ref int dst_len, byte[] wrkmem);
Usage:
byte[] dst = new byte[origlen];
int outlen = origlen;
if (Is64Bit())
lzo1x_decompress(src, src.Length - 4, dst, ref outlen, _workMemory);
else
lzo1x_decompress32(src, src.Length - 4, dst, ref outlen, _workMemory);
It is expected to lzo1x_decompress(...) to fill newly initialized byte[] dst array, but in VS 2013 the strange behaviour is that after calling that function, dst array turns to null value instead of be filled.
In addition the whole application state seems to be stable and no errors occurring during this.
What may cause this situation or how to avoid this or even debug what is wrong?