title: Blazor onclick event not triggered
body: <p>I try to implement a simple onclick event handler like this sample <a href="https://blazorfiddle.com/s/counter" rel="noreferrer">https://blazorfiddle.com/s/counter</a> but not working in my solution. The event is only triggered at the run of the web page for unknown reasons.</p>
  <p>The HTML page with Blazor component is well show but when I click on the button, nothing is happening.</p>
  <p>I'm on VS 2019 .Net Core 3.0. ASP.NET MVC project</p>
  <p>Counter.razor file:</p>
  <pre><code>@using Microsoft.AspNetCore.Components
  
  &lt;p&gt;Current count: @currentCount&lt;/p&gt;
  
  &lt;button class=&quot;btn btn-primary&quot; onclick=&quot;@IncrementCount();&quot;&gt;Click me&lt;/button&gt;
  
  @code {
      int currentCount = 0;
  
      private async Task IncrementCount()
      {
          await Task.Run(() =&gt; currentCount++);
      }
  }
  </code></pre>
  <p>Index.cshtml:</p>
  <pre><code>@using WebApplication2.Views.Components
  
  @{
      ViewData[&quot;Title&quot;] = &quot;Home Page&quot;;
  }
  
  &lt;div class=&quot;text-center&quot;&gt;
      &lt;h1 class=&quot;display-4&quot;&gt;Welcome&lt;/h1&gt;
      &lt;p&gt;Learn about &lt;a href=&quot;https://docs.microsoft.com/aspnet/core&quot;&gt;building Web apps with ASP.NET Core&lt;/a&gt;.&lt;/p&gt;
  &lt;/div&gt;
  
  @(await Html.RenderComponentAsync&lt;Counter&gt;(RenderMode.Server, new { }))
  </code></pre>
  <p>startup.cs:</p>
  <pre class="lang-cs prettyprint-override"><code>public void ConfigureServices(IServiceCollection services)
  {
      services.AddControllersWithViews();
  
      services.AddHttpClient();
      services.AddRazorPages();
      services.AddServerSideBlazor();
      services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_3_0);
  
  }
  
  public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
  {
      if (env.IsDevelopment())
      {
          app.UseDeveloperExceptionPage();
      }
      else
      {
          app.UseExceptionHandler(&quot;/Home/Error&quot;);
          // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
          app.UseHsts();
      }
      app.UseHttpsRedirection();
      app.UseStaticFiles();
  
      app.UseRouting();
  
      app.UseAuthorization();
  
      app.UseEndpoints(endpoints =&gt;
      {
          endpoints.MapRazorPages();
          endpoints.MapBlazorHub();
          endpoints.MapControllerRoute(
              name: &quot;default&quot;,
              pattern: &quot;{controller=Home}/{action=Index}/{id?}&quot;);
      });
  }
  </code></pre>
  <p>The button in browser :</p>
  <pre class="lang-html prettyprint-override"><code>&lt;button class=&quot;btn btn-primary&quot; onclick=&quot;System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[System.Threading.Tasks.VoidTaskResult,WebApplication2.Views.Components.Counter+&lt;IncrementCount&gt;d__2];&quot;&gt;Click me&lt;/button&gt;
  </code></pre>
  <p>Error in browser:</p>
  <p><a href="https://i.stack.imgur.com/krqU7.png" rel="noreferrer">Bug in brower</a></p>