Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report for Bug 26846 on
GitHub or Developer Community if you have new
information to add and do not yet see a matching new report.
If the latest results still closely match this report, you can use the
In special cases on GitHub you might also want the comments:
GitHub Markdown with public comments
We have some code in finalizers that call Guid.NewGuid, which calls RNGCryptoServiceProvider.GetBytes for guid generation.
Sometimes that code hangs on appdomain unload with the following stacktrace from gdb:
#0 0x00007f1b28578dbd in read () at ../sysdeps/unix/syscall-template.S:81
#1 0x00000000005832d9 in read (nbytes=14, buf=0x7f1b271fe382, __fd=0) at /usr/include/x86_64-linux-gnu/bits/unistd.h:44
#2 ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_RngGetBytes (handle=0x0, arry=<optimized out>) at rand.c:295
#3 0x0000000041fcb238 in ?? ()
#4 0x00007f1b271fe168 in ?? ()
Note that "read" call reads from fd 0 (stdin) which leads to hang.
I found only one case when it's possible:
handle is zeroed in RNGCryptoServiceProvider's destructor
The following patch was successfully (but not correctly) fixed it: https://github.com/JetBrains/mono/commit/f6d77139e76c4f76ddef954411892367d82795f4
On my codebase the bug is reproduced consistently, but I was unable to extract smaller sample.
I'm ready to test the solution from Mono at any time.