Bug 15154 - AVAudioSession should not have a default constructor
Summary: AVAudioSession should not have a default constructor
Status: RESOLVED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: 6.9.5.x
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-10-02 19:57 UTC by Larry O'Brien
Modified: 2013-10-02 20:35 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and 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 Links.

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.

Related Links:
Status:
RESOLVED FIXED

Description Larry O'Brien 2013-10-02 19:57:24 UTC
`AVAudioSession` is a singleton (`AVAudioSession.SharedInstance`) and the developer should not be able to call the default constructor.  

Ref. https://developer.apple.com/library/ios/documentation/AVFoundation/Reference/AVAudioSession_ClassReference/Reference/Reference.html#//apple_ref/doc/uid/TP40008240
Comment 1 Sebastien Pouliot 2013-10-02 20:06:48 UTC
Good catch. Sadly removing the default .ctor would be a breaking change and it behave correctly* otherwise the test suite would have caught it.

I'll add an [Obsolete ("Please use the static ShareInstance property")] to the .ctor

* when it does not we add an empty .ctor (which does nothing) to maintain API compatibility.
Comment 2 Sebastien Pouliot 2013-10-02 20:35:07 UTC
Fixed in master 6cf62887bed6fa9e0059314ba609bedc57282dfc

---

Type Changed: MonoTouch.AVFoundation.AVAudioSession

Removed constructors:

	public AVAudioSession ();

Added constructors:

	[Obsolete ("Please use the static SharedInstance property as this type is not meant to be created")]
	public AVAudioSession ();

---

I also switched from:

		[EditorBrowsable (EditorBrowsableState.Advanced)]
to:

		[EditorBrowsable (EditorBrowsableState.Never)]

to make the default ctor even less discoverable / tempting.