title: The assembly does not contain a public invokable method with [JSInvokableAttribute]
body: <p>We use Blazor WebAssembly and I want to call an non-static method in my Index.razor-File by JavaScript.</p>
  <p><strong>JavaScript:</strong></p>
  <pre><code>(function () {
  
      // keydown event
      window.addEventListener(&quot;keydown&quot;, function (e) {
          DotNet.invokeMethodAsync('MyBlazorWebAssemblyApp.Client', 'MyMethod');
      });
  })();
  </code></pre>
  <p><strong>Index.razor:</strong></p>
  <pre><code>@page &quot;/&quot;
  @inject HttpClient Http
  
  @code {
      
      // [...]
      
      [JSInvokable]
      public async Task MyMethod()
      {
          var lResponse = await Http.GetFromJsonAsync&lt;object&gt;(&quot;Controller/Action&quot;);
      }
  }
  </code></pre>
  <p>When I execute the code by an keydown, then the developer tools in Microsoft Edge shows me the following error:</p>
  <blockquote>
  <p>blazor.webassembly.js:1 System.ArgumentException: The assembly
  'MyBlazorWebAssemblyApp.Client' does not contain a public invokable
  method with [JSInvokableAttribute(&quot;MyMethod&quot;)].</p>
  </blockquote>
  <p>When I replace the attribute <code>[JSInvokable]</code> by <code>[JSInvokableAttribute(&quot;MyMethod&quot;)]</code> then the same error appears.</p>
  <p>How can I fix this problem?</p>