Xamarin.Forms DependencyService Get() Method Returns Null in PCL
<p>I have the latest Xamarin Alpha installed and can't get UWP and DependencyService working.</p>

<p>In the UWP project I have:</p>

<pre><code>Forms.Init(e);

// For release version, doc said debug will do this itself
DependencyService.Register&lt;SpecialInterface&gt;();
IInterface1 iinterface1 = DependencyService.Get&lt;IInterface1&gt;();
</code></pre>

<p>This does find the interface pointer.</p>

<p>In a PCL I have:</p>

<pre><code>IInterface1 iinterface1 = DependencyService.Get&lt;IInterface1&gt;();
</code></pre>

<p>In a view model contained in the PCL (after a button click) it fails returning a <code>null</code> value for the <code>Get&lt;IInterface1&gt;()</code> call on both UWP and Android.</p>

<p>Here is the implementation contained in the UWP project:</p>

<pre><code>using PrismUnityApp2.UWP;
using SharedProject1;
using Xamarin.Forms;

[assembly: Dependency(typeof(SpecialInterface))]

namespace PrismUnityApp2.UWP
{
    public class SpecialInterface : IInterface1
    {
        public SpecialInterface() { }

        public int TestMethod(int i)
        {
            return i;
        }
    }
}
</code></pre>

<p>Finally, the Interface is defined in a Shared Project as follows:</p>

<pre><code>namespace SharedProject1
{
    internal interface IInterface1
    {
        int TestMethod(int i);
    }
}
</code></pre>

<p>I have the sample "UsingDependencyService" working in Android, WinPhone fails because HyperV is off for Android.</p>

<p>What am I missing?</p>

<p>Thanks for any help.</p>

<p>Using following packages/versions:</p>

<ul>
<li>Prism.Unity.Forms 6.2.0.pre4</li>
<li>Prism.Forms 6.1.0.pre4</li>
<li>Xamarin.Forms 2.2.0.45</li>
<li>Unity 4.0.1</li>
<li><p>Windows 10 UWP</p>

<pre><code>public void OnNavigatedTo(NavigationParameters parameters)
{
    if (parameters.ContainsKey("title"))
        Title = (string) parameters["title"] + " and Prism";

    IInterface1 iinterface1 = DependencyService.Get&lt;IInterface1&gt;();
    if (iinterface1 != null)
    {
        int value = iinterface1.TestMethod(1);
        Title += " ::: " + value;
    }
}
</code></pre></li>
</ul>