Please take a moment to fill out the following (change to preview to check or place x in []):
This is a
[x] Bug
[ ] Feature Request
Which plugin does this impact:
[ ] Battery
[ ] Connectivity
[ ] Contacts
[ ] DeviceInfo
[ ] ExternalMaps
[ ] Geolocator
[ ] Media
[ ] Permissions
[x] Settings
[ ] Text To Speech
[ ] Vibrate
Other:
Version Number of Plugin: 2.1.0
Device Tested On: Nexus 6P, Android version 6.0.1
Simulator Tested On: iPhone 6s, iOS version 9.2
Actual Behavior
On iOS: AddOrUpdateValue("key", null) throws ArgumentNullException. This is the same behavior as iOS's native NSUserDefaults.
On Android: AddOrUpdateValue("key", null) adds/updates the "key" with empty string as the value. This is different from the iOS behavior of this library, and also different from Android's native SharedPreferences behavior which actually removes the key if it was already present, or doesn't do anything otherwise.
Expected Behavior
To keep the behavior of the library consistent for all platforms, it should throw ArgumentNullException in this case. This will ensure that the application code relying on this library behaves the same way across all platforms. That is the whole purpose of using a cross-platform library in the first place.
Please take a moment to fill out the following (change to preview to check or place x in []):
This is a
Which plugin does this impact:
Version Number of Plugin: 2.1.0 Device Tested On: Nexus 6P, Android version 6.0.1 Simulator Tested On: iPhone 6s, iOS version 9.2
Actual Behavior
On iOS: AddOrUpdateValue("key", null) throws ArgumentNullException. This is the same behavior as iOS's native NSUserDefaults.
On Android: AddOrUpdateValue("key", null) adds/updates the "key" with empty string as the value. This is different from the iOS behavior of this library, and also different from Android's native SharedPreferences behavior which actually removes the key if it was already present, or doesn't do anything otherwise.
Expected Behavior
To keep the behavior of the library consistent for all platforms, it should throw ArgumentNullException in this case. This will ensure that the application code relying on this library behaves the same way across all platforms. That is the whole purpose of using a cross-platform library in the first place.
Steps to reproduce the Behavior
Call Settings.AddOrUpdateValue("key", null);
This is related to https://github.com/jamesmontemagno/Xamarin.Plugins/issues/195 as the root cause of both is same.