This fixes the following test failures when building for debug with all optimizations enabled:
DispatchTests
[FAIL] DispatchTests.EverAfter : thread check hit
Expected: same as <UIKit.UIKitThreadAccessException>
But was: <System.ArgumentNullException>
at MonoTouchFixtures.CoreFoundation.DispatchTests.EverAfter () [0x000e1] in /Users/xamarinqa/vsts/_work/52/s/tests/monotouch-test/CoreFoundation/DispatchTests.cs:259
at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&)
[FAIL] DispatchTests.MainQueueDispatch : thread check hit
Expected: same as <UIKit.UIKitThreadAccessException>
But was: <System.ArgumentNullException>
at MonoTouchFixtures.CoreFoundation.DispatchTests.MainQueueDispatch () [0x000d1] in /Users/xamarinqa/vsts/_work/52/s/tests/monotouch-test/CoreFoundation/DispatchTests.cs:111
at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&)
The original, now obsoleted, `LocalizedString` API returned a .net
`string` which does not work in most cases.
Different versions of iOS seems to return different (public or internal)
subclasses of `NSString` that are understood by other API (like NSString
`localizedStringWithFormat:`) for further customization.
Our logic to convert NSString to string is correct but it cannot
recreate the custom, required subclass to continue the localization.
So the new API return an `NSString` publicly (which is actually a
subclass) that can do the required job.
Adding a test in monotouch-test is presently blocked by #3265 [2]
[1] https://bugzilla.xamarin.com/show_bug.cgi?id=41292
[2] https://github.com/xamarin/xamarin-macios/issues/3265
* Add tests for new (and old) NSBundle API and adjust old ones since adding a Base.lproj directories changes things
* Add localization to xammac_tests since it shares the same, updated tests
* [MSBuild] Do not set CFBundleDevelopmentRegion if not present.
This is a complicated fix. This is a regression introduced by Apple.
CFLocaleCopyCurrent(), used in the iOS code, will return the value of
the application's CFBundleDevelopmentRegion Info.plist key if all of the
following conditions are true:
* CFBundleDevelopmentRegion is present in the Info.plist
* The CFBundleDevelopmentRegion language is in the list of preferred
languages on the iOS device, but isn't the first one
* There are no localized resources (i.e. no .lproj directory) in the app
for the first preferred locale
This differs from iOS 10 where the presence of the
CFBundleDevelopmentRegion key had no effect.
Note that if the CFBundleDevelopmentRegion key is not present at all,
CFLocaleCopyCurrent() always returns the first preferred locale as it
did in iOS 10.
We are adding the key by default in the plist of the applications which confuses users since they do not see the key in the .plist added by the template. This commit removes it to be more explicit and help users understand the behaviour.