Skip to content

Commit

Permalink
Gracefully error-out on StringBuilder BSTR marshalling on Mono (#98379)
Browse files Browse the repository at this point in the history
  • Loading branch information
jkoritzinsky authored Feb 13, 2024
1 parent 1781891 commit be5694d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/mono/mono/component/marshal-ilgen.c
Original file line number Diff line number Diff line change
Expand Up @@ -2247,6 +2247,12 @@ emit_marshal_object_ilgen (EmitMarshalContext *m, int argnum, MonoType *t,
encoding = cb_to_mono->get_string_encoding (m->piinfo, spec);
conv = cb_to_mono->get_ptr_to_stringbuilder_conv (m->piinfo, spec, &need_free);

if (conv == MONO_MARSHAL_CONV_INVALID) {
char *msg = g_strdup_printf ("stringbuilder marshalling conversion %d not implemented", encoding);
cb_to_mono->methodBuilder.emit_exception_marshal_directive (mb, msg);
break;
}

g_assert (encoding != -1);

if (m_type_is_byref (t)) {
Expand Down

0 comments on commit be5694d

Please sign in to comment.