Merge pull request #4248 from Unity-Technologies/boehm-gc-alloc-fixed
[mono.git] / mono / metadata / exception.h
1 #ifndef _MONO_METADATA_EXCEPTION_H_
2 #define _MONO_METADATA_EXCEPTION_H_
3
4 #include <mono/metadata/object.h>
5 #include <mono/metadata/image.h>
6
7 MONO_BEGIN_DECLS
8
9 extern MONO_API MonoException *
10 mono_exception_from_name               (MonoImage *image, 
11                                         const char* name_space, 
12                                         const char *name);
13
14 MONO_API MonoException *
15 mono_exception_from_token              (MonoImage *image, uint32_t token);
16
17 MONO_RT_EXTERNAL_ONLY
18 MONO_API MonoException *
19 mono_exception_from_name_two_strings (MonoImage *image, const char *name_space,
20                                       const char *name, MonoString *a1, MonoString *a2);
21
22 MONO_API MonoException *
23 mono_exception_from_name_msg           (MonoImage *image, const char *name_space,
24                                         const char *name, const char *msg);
25
26 MONO_RT_EXTERNAL_ONLY
27 MONO_API MonoException *
28 mono_exception_from_token_two_strings (MonoImage *image, uint32_t token,
29                                                    MonoString *a1, MonoString *a2);
30
31 extern MONO_API MonoException *
32 mono_exception_from_name_domain        (MonoDomain *domain, MonoImage *image, 
33                                         const char* name_space, 
34                                         const char *name);
35
36 MONO_API MonoException *
37 mono_get_exception_divide_by_zero      (void);
38
39 MONO_API MonoException *
40 mono_get_exception_security            (void);
41
42 MONO_API MonoException *
43 mono_get_exception_arithmetic          (void);
44
45 MONO_API MonoException *
46 mono_get_exception_overflow            (void);
47
48 MONO_API MonoException *
49 mono_get_exception_null_reference      (void);
50
51 MONO_API MonoException *
52 mono_get_exception_execution_engine    (const char *msg);
53
54 MONO_API MonoException *
55 mono_get_exception_thread_abort        (void);
56
57 MONO_API MonoException *
58 mono_get_exception_thread_state        (const char *msg);
59
60 MONO_API MonoException *
61 mono_get_exception_thread_interrupted  (void);
62
63 MONO_API MonoException *
64 mono_get_exception_serialization       (const char *msg);
65
66 MONO_API MonoException *
67 mono_get_exception_invalid_cast        (void);
68
69 MONO_API MonoException *
70 mono_get_exception_invalid_operation (const char *msg);
71
72 MONO_API MonoException *
73 mono_get_exception_index_out_of_range  (void);
74
75 MONO_API MonoException *
76 mono_get_exception_array_type_mismatch (void);
77
78 MONO_API MonoException *
79 mono_get_exception_type_load           (MonoString *class_name, char *assembly_name);
80
81 MONO_API MonoException *
82 mono_get_exception_missing_method      (const char *class_name, const char *member_name);
83
84 MONO_API MonoException *
85 mono_get_exception_missing_field       (const char *class_name, const char *member_name);
86
87 MONO_API MonoException *
88 mono_get_exception_not_implemented     (const char *msg);
89
90 MONO_API MonoException *
91 mono_get_exception_not_supported       (const char *msg);
92
93 MONO_API MonoException*
94 mono_get_exception_argument_null       (const char *arg);
95
96 MONO_API MonoException *
97 mono_get_exception_argument            (const char *arg, const char *msg);
98
99 MONO_API MonoException *
100 mono_get_exception_argument_out_of_range (const char *arg);
101
102 MONO_API MonoException *
103 mono_get_exception_io                    (const char *msg);
104
105 MONO_API MonoException *
106 mono_get_exception_file_not_found        (MonoString *fname);
107
108 MONO_RT_EXTERNAL_ONLY
109 MONO_API MonoException *
110 mono_get_exception_file_not_found2       (const char *msg, MonoString *fname);
111
112 MONO_RT_EXTERNAL_ONLY
113 MONO_API MonoException *
114 mono_get_exception_type_initialization (const char *type_name, MonoException *inner);
115
116 MONO_API MonoException *
117 mono_get_exception_synchronization_lock (const char *msg);
118
119 MONO_API MonoException *
120 mono_get_exception_cannot_unload_appdomain (const char *msg);
121
122 MONO_API MonoException *
123 mono_get_exception_appdomain_unloaded (void);
124
125 MONO_API MonoException *
126 mono_get_exception_bad_image_format (const char *msg);
127
128 MONO_RT_EXTERNAL_ONLY
129 MONO_API MonoException *
130 mono_get_exception_bad_image_format2 (const char *msg, MonoString *fname);
131
132 MONO_API MonoException *
133 mono_get_exception_stack_overflow (void);
134
135 MONO_API MonoException *
136 mono_get_exception_out_of_memory (void);
137
138 MONO_API MonoException *
139 mono_get_exception_field_access (void);
140
141 MONO_API MonoException *
142 mono_get_exception_method_access (void);
143
144 MONO_RT_EXTERNAL_ONLY
145 MONO_API MonoException *
146 mono_get_exception_reflection_type_load (MonoArray *types, MonoArray *exceptions);
147
148 MONO_RT_EXTERNAL_ONLY
149 MONO_API MonoException *
150 mono_get_exception_runtime_wrapped (MonoObject *wrapped_exception);
151
152 /* Installs a function which is called when the runtime encounters an unhandled exception.
153  * This hook isn't expected to return.
154  * If no hook has been installed, the runtime will print a message before aborting.
155  */
156 typedef void  (*MonoUnhandledExceptionFunc)         (MonoObject *exc, void *user_data);
157 MONO_API void mono_install_unhandled_exception_hook (MonoUnhandledExceptionFunc func, void *user_data);
158 void          mono_invoke_unhandled_exception_hook  (MonoObject *exc);
159
160 MONO_END_DECLS
161
162 #endif /* _MONO_METADATA_EXCEPTION_H_ */