[mono-error] mono_class_from_name and mono_class_from_name_case now can cleanly retur...
[mono.git] / mono / metadata / rand.c
index eff2fff9851ced44e2155b2bd269729170ad6316..422bda1d1bc991994ec5012c02c00a1ddeae4580 100644 (file)
@@ -13,6 +13,7 @@
 #include <glib.h>
 
 #include "object.h"
+#include "object-internals.h"
 #include "rand.h"
 #include "utils/mono-rand.h"
 
@@ -32,8 +33,10 @@ ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_RngInitialize (M
 gpointer
 ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_RngGetBytes (gpointer handle, MonoArray *arry)
 {
+       MonoError error;
        g_assert (arry);
-       mono_rand_try_get_bytes (&handle, mono_array_addr (arry, guchar, 0), mono_array_length (arry));
+       mono_rand_try_get_bytes (&handle, mono_array_addr (arry, guchar, 0), mono_array_length (arry), &error);
+       mono_error_set_pending_exception (&error);
        return handle;
 }