Xam.Plugin.Connectivity doesn't work in .Net 4.5 Unit Test Project

aompgaompg DEMember

When using Xam.Plugin.Connectivity 2.0.0 via Nuget package in a PCL which includes .Net 4.5 as target, and using this PCL in an NUnit test project, a NotImplementedException gets thrown.

Here's the code in the plugin that probably leads to that:
https://github.com/jamesmontemagno/Xamarin.Plugins/blob/master/Connectivity/Connectivity/Connectivity.Plugin/CrossConnectivity.cs

#if PORTABLE
        return null;
#else

And then:

    if (ret == null)
    {
        throw NotImplementedInReferenceAssembly();
    }

Now I wonder how this can work if the library is meant to be portable, but the exception gets thrown when it's used in a portable library.

Or am I wrong and actually the return new ConnectivityImplementation(); line gets executed, but there just is no ConnectivityImplementation for .Net 4.5?

But .Net 4.5 seems to be a supported target, right?
(target="lib\portable-net45+wp80+wp81+wpa81+win8+MonoAndroid10+MonoTouch10+Xamarin.iOS10+UAP10\Plugin.Connectivity.dll" in https://github.com/jamesmontemagno/Xamarin.Plugins/blob/master/Connectivity/Connectivity.Plugin.nuspec)

The Nuget package is also referenced in the NUnit test project.

Can anyone help me figuring out why that exception gets thrown and if/why it's supposed to be that way?

Best Answer

Answers

Sign In or Register to comment.