[Mono-bugs] [Bug 699059] New: Unsafe interop code fails to be excecuted
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Thu Jun 9 09:58:35 EDT 2011
https://bugzilla.novell.com/show_bug.cgi?id=699059
https://bugzilla.novell.com/show_bug.cgi?id=699059#c0
Summary: Unsafe interop code fails to be excecuted
Classification: Mono
Product: Mono: Runtime
Version: 2.10.x
Platform: x86
OS/Version: Ubuntu
Status: NEW
Severity: Major
Priority: P5 - None
Component: interop
AssignedTo: mono-bugs at lists.ximian.com
ReportedBy: ToXedVirus at gmail.com
QAContact: mono-bugs at lists.ximian.com
Found By: ---
Blocker: ---
Created an attachment (id=433780)
--> (http://bugzilla.novell.com/attachment.cgi?id=433780)
Testcase of this
User-Agent: Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.24 (KHTML, like
Gecko) Ubuntu/10.10 Chromium/11.0.696.71 Chrome/11.0.696.71 Safari/534.24
If I pass an unsafe struct with a pointer modifier, the runtime complains:
Unhandled Exception: System.Runtime.InteropServices.MarshalDirectiveException:
Can not marshal 'parameter #1': Pointers can not reference marshaled
structures. Use byref instead.
Example:
unsafe ... {
public struct strarray
{
public sbyte **strarr;
public int length;
}
[DllImport("test")]
public static extern void outfunction(strarray *arr);
public static string[] marshalled_outfunction()
{
strarray arr;
outfunction(&arr); // exception
...
}
}
It works with 2.8 and fails to work on all subsequent versions!
Reproducible: Always
You can use git and checkout my monobugs repository on github:
https://github.com/txdv/monobugs
the code is in unsafe/
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the mono-bugs
mailing list