Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
GitHub or Developer Community with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
Created attachment 7104 [details]
Project with a few simple tests for this issue
Description of Problem:
Marshalling structs with strings fails when there is no null terminator on the string.
Steps to reproduce the problem:
1. Create a struct that contains a string set to MarshalAs ByValTStr.
2. Create a buffer from a string with no terminator.
3. Use Marshal.PtrToStructure to get an object and inspect the string.
Appears to read past the end of the buffer. String is often null but sometimes contains the correct chars but with extra appended to it.
Should read the string correctly.
How often does this happen?
See attached project.
Only tested with Xamarin Studio 4.2.2 (Mono 3.3?) and .Net 4.5 on Windows 7, but this was found in our live system on Mono 2.10 Linux.
Fixed in mono master faa73b12907c703464ec52ccd11fc2f9a9dd8bd3.
I have checked this issue and run the attached project, it runs successfully as shown in screencst : http://screencast.com/t/achQSxl2p
Hence closing this issue.