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.
On Windows, my application which uses Embedded Mono is not marshalling
string correctly as return values.
The strings come back as all Question marks (possibly unicode?)
However, the same technique using IntPtr works.
Attached is the project
Created attachment 1508 [details]
Zip file containing both C# assembly and C++ driving program.
I should have said this is on Windows using Mono-2.10.8
One additional thing here, My machine is Win7 64-bit, and I built mono.lib
using the instructions found here:
try [return: MarshalAs(UnmanagedType.LPWStr)]
on the pinvoke declaration.
Tried your suggestion, same garbage result, also tried UnmanagedType.LPStr, no
Robert Jordan tried the code himself in a non-embedded fashion, it also shows
the bug, his test code is here:
He confirmed the problem with Mono-2.10.8, but said the code did work with
a master based build, so hopefully it has already been fixed, I did some
diffs against marshal.c and there were some changes that seemed related.