[Mono-bugs] [Bug 461867] New: Marshal.GetFunctionPointerForDelegate crashed runtime

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Dec 23 00:10:28 EST 2008


https://bugzilla.novell.com/show_bug.cgi?id=461867


           Summary: Marshal.GetFunctionPointerForDelegate crashed runtime
           Product: Mono: Runtime
           Version: 2.2.x
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: JIT
        AssignedTo: lupus at novell.com
        ReportedBy: eugeny.grishul at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: Third Party Developer/Partner


Delegates returning 'char' are crashing runtime due call to
Marshal.GetFunctionPointerForDelegate. But it can simply workarounded replacing
'char' to 'short' in code below:


public static CharacterAtIndex CharacterAtIndexTrampoline =
CharacterAtIndexImpl;
public delegate char CharacterAtIndex( IntPtr @this, IntPtr selector, int index
);

private static char CharacterAtIndexImpl( IntPtr @this, IntPtr selector, int
index )
{
        return '5';
}

private static void Main( string[] args )
{
Marshal.GetFunctionPointerForDelegate( CharacterAtIndexTrampoline );
}

Program log:

** (NObjective.Performance.exe:2441): WARNING **: return type 0x03 unknown
**
ERROR:marshal.c:9123:mono_marshal_emit_managed_wrapper: code should not be
reached
Stacktrace:

  at (wrapper managed-to-native) object.__icall_wrapper_mono_delegate_to_ftnptr
(object) <0x00004>
  at (wrapper managed-to-native) object.__icall_wrapper_mono_delegate_to_ftnptr
(object) <0xffffffff>
  at (wrapper managed-to-native)
System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegateInternal
(System.Delegate) <0xffffffff>
  at System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate
(System.Delegate) <0x00016>
  at NObjective.Program.Main (string[]) <0x00014>
  at (wrapper runtime-invoke) NObjective.Program.runtime_invoke_void_object
(object,intptr,intptr,intptr) <0xffffffff>
/run_all.sh: line 25:  2441 Abort trap              mono
NObjective.Performance.exe


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list