title: Xamarin.Essentials.NotImplementedInReferenceAssemblyException thrown when Unit Testing Xamarin.Forms app
body: <p>I am running Unit Tests for my Xamarin.Forms application, and the Unit Tests throw <code>Xamarin.Essentials.NotImplementedInReferenceAssemblyException</code>:</p>
  <p><a href="https://i.stack.imgur.com/0sSzA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0sSzA.png" alt="enter image description here" /></a></p>
  <p>I have created a Unit Test project for the app (using NUnit 3.12.0) and have written the below code to test the functionality.</p>
  <pre><code>[TestFixture()]
  public class Test
  {
      [Test()]
      public void TestCase()
      {
          AutoResetEvent autoEvent = new AutoResetEvent(true);
  
          SomeClass someClass = new SomeClass();
          someClass.SomeFunction((response) =&gt;
          {
              Assert.AreEqual(response, &quot;Hello&quot;)
              autoEvent.Set();
          });
  
          autoEvent.WaitOne(); //** Xamarin.Essentials.NotImplementedInReferenceAssemblyException thrown here**
      }
  }
  </code></pre>
  <p>Below is the code under test from the Xamarin.Forms app:</p>
  <pre><code>public class SomeClass
  {
      
      public void SomeFunction(Action&lt;string&gt; callback)
      {
          // asynchronous code...
          callback(&quot;Hello&quot;);
      }
  }
  </code></pre>
  <p>The above functionality works fine in the Xamarin.Forms app.</p>
  <p><strong>Note</strong>: I read that await/async can be used, however, I will have to make changes in the entire project. This is not a feasible solution for now.</p>
  <hr />
  <p><strong>Edit 1:</strong>
  I have created a sample Xamarin.Forms project with Unit Tests in it. The project is available <a href="https://drive.google.com/drive/folders/1Lg2bQd_qN8xOYmgbglDY0WYv-RWEiREC?usp=sharing" rel="nofollow noreferrer">here</a></p>