Closed eloekset closed 8 years ago
@eloekset I'll run some tests on my side this evening. Get back to you soon.
@eloekset Done some investigation. The plugin uses delayed initialization to initialize the CrossMessaging.Current
singleton that the MessagingPlugin
class uses behind the scenes. I've never been a fan of the singleton approach but this is the design recommended for providing consistent API across the different Xamarin plugins.
The singleton gets initialized on first access. If first access happens from a PCL assembly where the platform specific functionality is not supported, you may end up with a singleton initialized incorrectly. When you subsequently access the API from a non-PCL assembly you will then get the exception.
Can you perhaps verify whether you are accessing the plugin functionality from within a PCL before using it in the Android library snippet above?
Thanks for your help @cjlotz! Before closing this issue, I'll post an update on what I found, although I'm not really sure what really caused the problem.
Either the Android assembly in v3.2.1 of the NuGet package is mixed up with the PCL assembly, or I must be misunderstanding something. See the screenshot from a debug session running on my Android device, showing the EmailMessenger implementation in my Android project throwing NotImplementedException. Looking through the code, it seems like this exception should be thrown in the PCL implementation, but not in the Android implementation.