mono_set_pending_exception (mono_get_exception_execution_engine ("Failed to convert StringBuilder from utf16 to utf8"));
return NULL;
} else {
guint len = mono_string_builder_capacity (sb) + 1;
gchar *res = (gchar *)mono_marshal_alloc (len * sizeof (gchar), &error);
if (!mono_error_ok (&error)) {
mono_set_pending_exception (mono_get_exception_execution_engine ("Failed to convert StringBuilder from utf16 to utf8"));
return NULL;
} else {
guint len = mono_string_builder_capacity (sb) + 1;
gchar *res = (gchar *)mono_marshal_alloc (len * sizeof (gchar), &error);
if (!mono_error_ok (&error)) {