[Mono-bugs] [Bug 557684] New: MonoEmbedded: 'mono_method_desc_search_in_class' doesn't find methods with struct parameter
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Mon Nov 23 05:19:44 EST 2009
http://bugzilla.novell.com/show_bug.cgi?id=557684
http://bugzilla.novell.com/show_bug.cgi?id=557684#c0
Summary: MonoEmbedded: 'mono_method_desc_search_in_class'
doesn't find methods with struct parameter
Classification: Mono
Product: Mono: Tools
Version: 2.4.x
Platform: i386
OS/Version: Windows XP
Status: NEW
Severity: Major
Priority: P5 - None
Component: tools
AssignedTo: mono-bugs at lists.ximian.com
ReportedBy: ralf.kornelius at kobil.com
QAContact: mono-bugs at lists.ximian.com
Found By: ---
Blocker: ---
Description of Problem:
I have a test assembly with 2 methods:
- TestStructure:GetStructure()
- void:SendStructure(TestStructure)
and I want to use this method in C-Code with MonoEmbedding.
When searching for the first method (with struct output/return-parameter),
'mono_method_desc_search_in_class' will find the method!
But when searching for the second method (with struct input-parameter),
'mono_method_desc_search_in_class' doesn't find the method and returns NULL!
Steps to reproduce the problem:
1. Compile C-Program with MonoEmbedding
----------------------------------------------------------
// BugMonoStructParam.cpp : Definiert den Einstiegspunkt für die
Konsolenanwendung.
//
#include <direct.h> // for getcwd
#include <stdlib.h> // for MAX_PATH
#include <assert.h>
#include <glib.h>
#include <mono/jit/jit.h>
#include <mono/metadata/assembly.h>
#include <mono/metadata/Debug-helpers.h>
int main(int argc, char* argv[])
{
//Current Working Directory
// _MAX_PATH is the maximum length allowed for a path
char CurrentPath[_MAX_PATH];
// use the function to get the path
_getcwd(CurrentPath, _MAX_PATH);
//Set paths
mono_set_dirs(CurrentPath,CurrentPath);
MonoDomain *m_domain = mono_jit_init ("TestAssembly.dll");
MonoAssembly *m_assembly = mono_domain_assembly_open (m_domain,
"TestAssembly.dll");
MonoImage *m_image = mono_assembly_get_image (m_assembly);
MonoClass *klass = mono_class_from_name (m_image, "TestAssembly" , "Test");
//Getting method with struct input-parameter via search
MonoMethodDesc* descMethodeReturnStruct = mono_method_desc_new
("TestStructure:GetStructure()",true);
MonoMethod* monoMethodeReturnStruct = mono_method_desc_search_in_class
(descMethodeReturnStruct, klass);
assert(monoMethodeReturnStruct != NULL); //OK
mono_method_desc_free (descMethodeReturnStruct);
//Getting method with struct output-parameter direct
MonoMethod* monoMethodTakeStruct_direct = mono_class_get_method_from_name
(klass, "SendStructure", 1);
assert(monoMethodTakeStruct_direct != NULL); //OK
//Getting method with struct output-parameter via search
MonoMethodDesc* descMethodTakeStruct = mono_method_desc_new
("void:SendStructure(TestStructure)",true);
MonoMethod* monoMethodTakeStruct = mono_method_desc_search_in_class
(descMethodTakeStruct, klass);
assert(monoMethodTakeStruct != NULL); //Crash --> Bug?
mono_method_desc_free (descMethodTakeStruct);
}
----------------------------------------------------------
2. Compile Managed Assembly "TestAssembly.dll"
----------------------------------------------------------
using System;
namespace TestAssembly
{
public class Test
{
public struct TestStructure
{
public int i;
public float f;
}
public void SendStructure(TestStructure s)
{
Console.WriteLine("StructureValueTypes:");
Console.WriteLine("Integer: " + s.i);
Console.WriteLine("Float: :" + s.f);
}
public TestStructure GetStructure()
{
TestStructure s;
s.i = 42;
s.f = float.MaxValue;
return s;
}
}
}
----------------------------------------------------------
3. Run C-Program
Actual Results:
Method with struct input-parameter can't be found by
'mono_method_desc_search_in_class'
Method with struct input-parameter can be found by
'mono_class_get_method_from_name'
Expected Results:
Method with struct input-parameter should be found by
'mono_method_desc_search_in_class'
How often does this happen?
Always
Additional Information:
-
--
Configure bugmail: http://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