A
Andreas Selle
Hi,
I guess I found some small incompatibility with Beta 2 NETCF V2.
I have the following P/Invoke scenario: I create a StringBuilder instance
with a large enough capacity and pass it to a native function that fills
this buffer with multiple adjacent nul-terminated strings and returns the
total count of characters (including nul characters) that have been stored
in the buffer. After the call I convert the StringBuffer to a String. The C#
code looks like this:
StringBuilder mszBuffer = new StringBuilder(2000);
int cch = MyNativeFunction(mszBuffer)
string msz = mszBuffer.ToString(0, cch);
This used to work with the old NETCF V1 but now the call to ToString()
throws an ArgumentOutOfRange exception. Probably ToString() now checks the
given cch against mszBuffer.Length, however mszBuffer.Length only returns
the length of the first string that was added to the buffer.
Hope that my explanation was clear enough.
Cheers,
Andreas
I guess I found some small incompatibility with Beta 2 NETCF V2.
I have the following P/Invoke scenario: I create a StringBuilder instance
with a large enough capacity and pass it to a native function that fills
this buffer with multiple adjacent nul-terminated strings and returns the
total count of characters (including nul characters) that have been stored
in the buffer. After the call I convert the StringBuffer to a String. The C#
code looks like this:
StringBuilder mszBuffer = new StringBuilder(2000);
int cch = MyNativeFunction(mszBuffer)
string msz = mszBuffer.ToString(0, cch);
This used to work with the old NETCF V1 but now the call to ToString()
throws an ArgumentOutOfRange exception. Probably ToString() now checks the
given cch against mszBuffer.Length, however mszBuffer.Length only returns
the length of the first string that was added to the buffer.
Hope that my explanation was clear enough.
Cheers,
Andreas