Skip to content

Commit 43fcc88

Browse files
committed
Exposing functions: mono_custom_attrs_construct_by_type and mono_unity_error_convert_to_exception
* mono_custom_attrs_construct_by_type allows unity to have a chance at handling the error if one arises instead of fatally asserting * mono_unity_error_convert_to_exception allows unity to take the provided MonoError and fetch the MonoException object within to log into the editor as the exception that was thrown. This change has associated unity changes in order to fix (case 1255935)
1 parent c867676 commit 43fcc88

File tree

4 files changed

+8
-1
lines changed

4 files changed

+8
-1
lines changed

mono/metadata/custom-attrs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1215,7 +1215,7 @@ create_custom_attr_data (MonoImage *image, MonoCustomAttrEntry *cattr, MonoError
12151215
HANDLE_FUNCTION_RETURN_OBJ (obj);
12161216
}
12171217

1218-
static MonoArray*
1218+
MonoArray*
12191219
mono_custom_attrs_construct_by_type (MonoCustomAttrInfo *cinfo, MonoClass *attr_klass, MonoError *error)
12201220
{
12211221
MonoArray *result;

mono/metadata/reflection.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ MONO_RT_EXTERNAL_ONLY
9090
MONO_API MonoCustomAttrInfo* mono_reflection_get_custom_attrs_info (MonoObject *obj);
9191
MONO_RT_EXTERNAL_ONLY
9292
MONO_API MonoArray* mono_custom_attrs_construct (MonoCustomAttrInfo *cinfo);
93+
MONO_API MonoArray* mono_custom_attrs_construct_by_type (MonoCustomAttrInfo *cinfo, MonoClass *attr_klass, MonoError *error);
9394
MONO_RT_EXTERNAL_ONLY
9495
MONO_API MonoCustomAttrInfo* mono_custom_attrs_from_index (MonoImage *image, uint32_t idx);
9596
MONO_RT_EXTERNAL_ONLY

mono/metadata/unity-utils.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,11 @@ MonoException* mono_unity_exception_get_marshal_directive(const char* msg)
870870
return mono_exception_from_name_msg(mono_get_corlib(), "System.Runtime.InteropServices", "MarshalDirectiveException", msg);
871871
}
872872

873+
MonoException* mono_unity_error_convert_to_exception (MonoError *error)
874+
{
875+
return mono_error_convert_to_exception (error);
876+
}
877+
873878
//defaults
874879

875880
MonoClass* mono_unity_defaults_get_int_class()

mono/metadata/unity-utils.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ MonoObject* mono_unity_exception_get_inner_exception(MonoException *exc);
137137
MonoArray* mono_unity_exception_get_trace_ips(MonoException *exc);
138138
void mono_unity_exception_set_trace_ips(MonoException *exc, MonoArray *ips);
139139
MonoException* mono_unity_exception_get_marshal_directive(const char* msg);
140+
MONO_API MonoException* mono_unity_error_convert_to_exception(MonoError *error);
140141

141142
//defaults
142143
MonoClass* mono_unity_defaults_get_int_class();

0 commit comments

Comments
 (0)