[Mono-dev] Embedded API: mono_array_element_size issue

2013-10-02 Thread jonat...@mugginsoft.com
The following raises so I presume that I have used it incorrectly:
   
MonoClass *arrayClass = mono_get_byte_class();
int32_t elementSize = mono_array_element_size(arrayClass);

* Assertion at class.c:8201, condition `ac-rank' not met

The entire method is:

- (MonoArray *)monoArray {

// get mono array info
MonoClass *arrayClass = mono_get_byte_class();
int32_t elementSize = mono_array_element_size(arrayClass);
//int32_t elementSize = sizeof(char);  // workaround

// assign the mono array
uintptr_t byteLength = [self length];
MonoArray *monoArray = mono_array_new(mono_domain_get(), arrayClass, 
byteLength);

// copy the NSData bytes  to the Mono array
char *buffer = mono_array_addr_with_size(monoArray, elementSize, 0);
[self getBytes:buffer length:[self length]];

return(monoArray);
}

Jonathan










___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Embedded API: mono_array_element_size issue

2013-10-02 Thread Robert Jordan

Jonathan,

On 02.10.2013 12:21, jonat...@mugginsoft.com wrote:

The following raises so I presume that I have used it incorrectly:

 MonoClass *arrayClass = mono_get_byte_class();
 int32_t elementSize = mono_array_element_size(arrayClass);

* Assertion at class.c:8201, condition `ac-rank' not met



This is because arrayClass is not the MonoClass of a MonoArray.

You need something like that:

// assign the mono array
uintptr_t byteLength = [self length];
MonoArray *monoArray = mono_array_new(mono_domain_get(), 
mono_get_byte_class(), byteLength);
int32_t elementSize = 
mono_array_element_size(mono_object_get_class((MonoObject*)monoArray);


Robert


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] WCF compilation

2013-10-02 Thread Neale Ferguson
Hi,
 I am writing a WCF-based service which I¹m making available via xsp. When I
go to access it, the compilation starts as expected. However, the parameters
used by the mcs.exe process that is kicked off doesn¹t include a
­r:System.Web that my service needs to build cleanly. I added the following
to web.config within the system.web and compilation sections:

compiler language=cs;c#;csharp extension=.cs warningLevel=1
compilerOptions=/codepage:utf8
/r:System.Web
   
type=Microsoft.CSharp.CSharpCodeProvider, System, Version=1.0.5000.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089 /

However, it seems to have no effect. Neither option is being used. Is there
something else I need to be doing?

Neale
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list