title: Dependency service event
body: <p>I am trying to call the event handler from droid side, however it doesn't get fired. everyone else works however this event doesn't get fired. I am not sure what am I doing wrong. I have my dependency service registered at MainActivity and set dependency in my service.</p>
  <pre class="lang-cs prettyprint-override"><code>public partial class MainPage : ContentPage
  {
    DocumentResults results;
    IScanService scanService;
    
    public MainPage()
    {
        InitializeComponent();
        results = new DocumentResults();
        BindingContext = new MainPageViewModel();
        System.Diagnostics.Debug.WriteLine(&quot;test cw&quot;);
        Console.WriteLine(&quot;test cw&quot;);
           scanService = DependencyService.Get&lt;IScanService&gt;();
       scanService.ResultsParsedEvent += (s, ev) =&gt; { ResultsParsed(null, ev); };
    }
  
    void Button_Clicked(System.Object sender, System.EventArgs e)
    {
      scanService.ScanService();
  
      if (!String.IsNullOrWhiteSpace(test))
      {
        scanService.Parsing(test);
      }
    }
  
    private void ResultsParsed(DocumentResults results,EventArgs e)
    {
      Console.WriteLine(&quot;update &quot;);
      testLbl.Text = results.Name;
    }
  }
  </code></pre>
  <p>My interface</p>
  <pre class="lang-cs prettyprint-override"><code>public interface IScanService
  {
    event EventHandler ResultsParsedEvent;
  
    string ScanService(); 
  
    void Parsing(string test);
  
    void resultsParsed(DocumentResults results, EventArgs e);
  }
  </code></pre>
  <p>Droid implementation</p>
  <pre class="lang-cs prettyprint-override"><code>public class RegService : IScanService
  {
    public event EventHandler ResultsParsedEvent;
    DocumentResults results;
    public string Test;
    
    public String ScanService()
    {
      Test = &quot;scan&quot;;
      return Test;
    }
  
    public void Parsing(string test)
    {
      Test = &quot;parsing&quot;;
      var results= new DocumentResults();
      results.Name = Test;
      Thread thread1 = new Thread(() =&gt; resultsParsed(results,null));
  
      System.Threading.Thread.Sleep(10);
      resultsParsed(results,null);
    }
  
    public void resultsParsed(DocumentResults results, EventArgs e)
    {
      ResultsParsedEvent?.Invoke(results, e);
    }
  }
  </code></pre>