diff --git a/docs/website/mmp-errors.md b/docs/website/mmp-errors.md index 7f6f9e2456..d80b4cffeb 100644 --- a/docs/website/mmp-errors.md +++ b/docs/website/mmp-errors.md @@ -796,4 +796,10 @@ This exception will have an inner exception which gives the reason for the failu ### MM8035: Failed to get the 'this' instance in a method call to {method}. -This exception will have an inner exception which gives the reason for the failure. \ No newline at end of file +This exception will have an inner exception which gives the reason for the failure. + + + +### MM8036: Failed to marshal the value at index {index}. + +This exception will have an inner exception which gives the reason for the failure. diff --git a/docs/website/mtouch-errors.md b/docs/website/mtouch-errors.md index cfbe9c5c3a..1a2eaedbfc 100644 --- a/docs/website/mtouch-errors.md +++ b/docs/website/mtouch-errors.md @@ -3586,3 +3586,9 @@ This exception will have an inner exception which gives the reason for the failu ### MT8035: Failed to get the 'this' instance in a method call to {method}. This exception will have an inner exception which gives the reason for the failure. + + + +### MT8036: Failed to convert the value at index {index} from {type} to {type}. + +This exception will have an inner exception which gives the reason for the failure. diff --git a/runtime/trampolines.m b/runtime/trampolines.m index 9bba912eac..3dd9a7a7f6 100644 --- a/runtime/trampolines.m +++ b/runtime/trampolines.m @@ -1197,8 +1197,10 @@ xamarin_convert_managed_to_nsarray_with_func (MonoArray *array, xamarin_managed_ for (int i = 0; i < length; i++) { MonoObject *value = mono_value_box (mono_domain_get (), element_class, ptr + element_size * i); buf [i] = convert (value, context, exception_gchandle); - if (*exception_gchandle != 0) + if (*exception_gchandle != 0) { + *exception_gchandle = xamarin_get_exception_for_element_conversion_failure (*exception_gchandle, i); goto exception_handling; + } } rv = [NSArray arrayWithObjects: buf count: length]; @@ -1225,8 +1227,10 @@ xamarin_convert_nsarray_to_managed_with_func (NSArray *array, MonoClass *managed char *ptr = (char *) mono_array_addr_with_size (rv, element_size, 0); for (int i = 0; i < length; i++) { valueptr = convert ([array objectAtIndex: i], valueptr, managedElementType, context, exception_gchandle); - if (*exception_gchandle != 0) + if (*exception_gchandle != 0) { + *exception_gchandle = xamarin_get_exception_for_element_conversion_failure (*exception_gchandle, i); goto exception_handling; + } memcpy (ptr, valueptr, element_size); ptr += element_size; }