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 on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
Created attachment 25226 [details]
Utilizing InputAudioQueue from the AudioToolbox namespace in Xamarin.iOS for recording audio. When stopping the recording session, the application will hang for a few seconds (or sometimes indefinitly hang) when InputAudioQueue has been flagged for disposal after calling InputAudioQueue.FreeBuffer.
If audio buffers are not freed and InputAudioQueue.Dispose is called, the app will function as expected and will not hang when the code tries to flag that object for disposal, however if .FreeBuffer() was called before the .Dispose, the app will hang on the .Dispose after Freeing Buffers.
##Steps to reproduce
1). Download attached sample
2). After building and deploying to Simulator or Device, click on Start Recording
3). After a few seconds, click on Stop Recording
4). The UITextView will indicate the status of the application, notice how the app seems to have frozen up until it finally moves past the .Dispose call. (Line 109 in ViewController.cs)
5). Go into the ViewController.cs file and comment out the code that frees the audio buffers on lines 102-103.
6). Run the app again, Start Recording then Stop, notice how the InputAudioQueue gets Disposed of immediately this time when the buffers are not first freed.
I've added Console logs as well just to indicate when the buffers are freed and when .Dispose has been called on InputAudioQueue to show the timing between calls.
Xamarin.iOS application will hang when .Dispose is called on InputAudioQueue after calling InputAudioQueue.FreeBuffers but will not hang if we do not Free the audio Buffers first.
Xamarin.iOS application would Dispose of the InputAudioQueue without hanging the UI even after first freeing audio buffers via InputAudioQueue.FreeBuffer().
Moving the FreeBuffers call into an async method does help however this can pose some issues as the .Dispose still does take a while to complete and users can start a new recording without waiting for the previous InputAudioQueue to complete disposal. My main question is if this is the expected outcome as calling .Dispose on other objects does not cause this hang.
*** This bug has been marked as a duplicate of bug 59911 ***