In my Xamarin.Forms project I have a dependency interface
`/*
* Interface to get device IP address on network, implemented natively in .Droid's and .iOS's IPAddressManager.cs
*/
public interface IIPAddressManager
{
List<string> GetConnectedHostIPAddresses();
}`
which is then inherited from in my .iOS and .Droid's IPAddressManager.cs
classes.
using System.Collections.Generic;
using System.Net;
using System.Net.NetworkInformation;
using System.Threading.Tasks;
using Java.Lang;
using NDO.PortableDataViewer.Android.Android.DependencyServices;
// assembly registers this class to IIPAdressManager in NetworkService.cs
[assembly: Xamarin.Forms.Dependency (typeof(IPAddressManager))]
namespace NDO.PortableDataViewer.Android.Android.DependencyServices
{
public class IPAddressManager : Object, IIPAddressManager
I was initially getting 2 errors telling me I had to add a reference to assemblies. The first one was on the [assembly: Xamarin.Forms.Dependency (typeof(IPAddressManager))]
and was resolved using ReSharper per the instruction of this thread.
However, the second one is on IPAddressManager
inheriting IIPAddressManager
and has persisted. The error reads: The type 'List<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Collections, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
I can't use ReSharper to resolve this one.