Baseflow / XamarinMediaManager

Cross platform Xamarin plugin to play and control Audio and Video
https://baseflow.com
MIT License
762 stars 305 forks source link

Creating a new NSError is bad practice #841

Closed janwiebe-jump closed 2 years ago

janwiebe-jump commented 2 years ago

https://github.com/Baseflow/XamarinMediaManager/blob/cbb1b0a589d82a9c261afb8a4455cf56222499fd/MediaManager/Platforms/Apple/Player/AppleMediaPlayer.cs#L170

It looks like the usage of this NSError constructor is throwing an exception:

The operation couldn’t be completed. (Invalid .ctor used error 0.)

The documentation says:

Summary:
Do not use the Default Constructor unless you are dealing with a low-level API
that will initialize the object for you.

Remarks:
The default constructor for NSError leaves the object in a partial state that
can only be initialized by a handful of low-level Objective-C APIs. In general,
you should not use this constructor, you should instead use the constructor that
takes an NSString error domain argument.