title: Getting an Exception while calling some async methods from outside the class
body: <p>lets say i have  class  called x and y like this </p>
  
  <pre><code>class x
  {
      public x()
      {
           p();
      }
      private async p()
      {
        await q();
      }
      private async p()
      {
       //some logic is there  
      }
  }
  </code></pre>
  
  <p>in test.aspx.cs file </p>
  
  <p>i am trying to create an instance of this class </p>
  
  <pre><code>            x object =new x();
  </code></pre>
  
  <p>when i run this i get an exception at runtime  saying  :</p>
  
  <blockquote>
    <p>An asynchronous operation cannot be started at this time. Asynchronous operations may only be started within an asynchronous handler or module or during certain events in the Page lifecycle. If this exception occurred while executing a Page, ensure that the Page is marked &lt;%@ Page Async="true" %>. This exception may also indicate an attempt to call an "async void" method, which is generally unsupported within ASP.NET request processing. Instead, the asynchronous method should return a Task, and the caller should await it.</p>
  </blockquote>
  
  <p>can any body explain me why ?</p>