[Mono-dev] HandleRef regression in mono 1.2.3

Leszek Ciesielski skolima at gmail.com
Sun Feb 11 07:41:58 EST 2007


This is... strange.

We based our code on this article:
http://www.mono-project.com/Interop_with_Native_Libraries#GC-Safe_P.2FInvoke_code

Unfortunately, there's no edit date present. But the code using
HandleRef _did_ work in 1.2.1 (I did not check earlier versions, I
just checked it when my coworker said it has been broken with 1.2.3).

No matter how, I am glad this is fixed now :-)

On 2/11/07, Miguel de Icaza <miguel at novell.com> wrote:
> Hello,
>
> > my team has been using HandleRef for marshaling (as mono
> > http://www.mono-project.com/Interop_with_Native_Libraries and msdn
> > http://msdn2.microsoft.com/en-us/library/system.runtime.interopservices.handleref.aspx
> > suggest) for quite a long time. To our surprise, HandleRef no longer
> > works with the new release of mono.
>
> There is no regression, since HandleRef was never implemented in the
> Marshaller.   Either you just started using it, or you were getting
> corrupted data all along.
>
> That being said, it will be available in Mono 1.2.4, I have just
> implemented it.
>
> > Everything works fine with 2.0 profile. On 1.0, when I pass a
> > HandleRef to a native library expecting a pointer, marshaller feeds
> > garbage to the native code. The problem occurs both on linux and
> > windows. And yes, I can work around this problem by replacing
> > HandleRef by plain IntPtr's, but that's not the point, is it?
> >
> > I was also quite surprised by this bugzilla entry:
> > http://bugzilla.ximian.com/show_bug.cgi?id=80515 Does this mean that
> > the maintainer of interop stack is aware of the regression?
>
> I only recently discovered that we lacked support for this (while going
> through some Moma reports, as a couple of P/Invoke signatures had it,
> and I found out we did not support it).
>
> Miguel.
>


-- 
MS-DOS user since 5.0
Windows user since 3.11
Linux user since kernel 2.4
Novell Netware user since 2.2
WARCRAFT user since 1.0



More information about the Mono-devel-list mailing list