New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Configuration system throws PlatformNotSupportedException
on Xamarin Android.
#1151
Comments
Which platform-variant of FA is it picking up? You can determine that from the folder name that points to the DLL from your project. |
I'm not quite sure what that means, but dotPeek tells me it is the .NET Standard 2.0 variant. |
It looks like The recommendation from the Xamarin Forms team is to use Xamarin.Essentials.Preferences instead. |
Yeah, strangely it does compile, so something must have changed. We'll need to fix that. |
I imagine it compiles because of the odd Microsoft policy that it is acceptable for things to be part of the .NET Standard, but then throw not supported exceptions on platforms that are not applicable.... |
Some different possibilities.
|
Or we keep the current |
A variation on jnyrup suggestions would be in the set the pros:
cons:
#if NETSTANDARD1_3
Reflector = new NullReflector();
ConfigurationStore = new NullConfigurationStore();
#elif NETSTANDARD1_6
Reflector = new NetStandardReflector();
ConfigurationStore = new NullConfigurationStore();
#else
Reflector = new FullFrameworkReflector();
ConfigurationStore = new AppSettingsConfigurationStore();
// try to use the ConfigurationStore, catch any exceptions
// and set ConfigurationStore to NullConfigurationStore(); on exception.
#endif |
That's exactly what I proposed as well ;-) |
The fix is exactly what I did for my project. |
@jnyrup why was it moved to 6.0? You're envisioning a breaking change? |
I put this in the 6.0 milestone to make sure we at latest fix it there. |
Some platforms throws reflection exceptions when trying to use `ConfigurationManager`. This does not fix the underlying problem of not being unable to use `ConfigurationManager`, but returns `null` instead of an exception. Relates to fluentassertions#1207 and fluentassertions#1151
Some platforms throws reflection exceptions when trying to use `ConfigurationManager`. This does not fix the underlying problem of not being unable to use `ConfigurationManager`, but returns `null` instead of an exception. Relates to fluentassertions#1207 and fluentassertions#1151
Some platforms throws reflection exceptions when trying to use `ConfigurationManager`. This does not fix the underlying problem of not being unable to use `ConfigurationManager`, but returns `null` instead of an exception. Relates to fluentassertions#1207 and fluentassertions#1151
Fixed in #1210, which is included in 5.10.0 |
Description
Configuration system throws
PlatformNotSupportedException
on Xamarin Android.Complete minimal example reproducing the issue
Expected behavior:
The normal assertion failure process
Actual behavior:
The following Exception is thrown:
Versions
FluentAssertions 5.9.0
Xamarin.Android SDK 9.1.7.0 (HEAD/ba9da7a76)
Emulator 27.3.9-4899998 API 27 (x86)
The text was updated successfully, but these errors were encountered: