title: Task.Run does not run the methods?
body: <p>I have a weird bug in an ASP.NET application. I have 2 methods that calculate the interest for a loan and the principal which are inserted in a CSV file. The weird thing is that if I wrap the calculations in a Task.Run() the first time when I start the application the calculations are not done and I receive value 0 in the CSV. The second time when the calculations are run(while the application is still running), they are correctly calculated and inserted in the CSV file. I disabled the Task.Run() and I run the calculation and I did not encounter this bug anymore. Also, when the calculations run in the Task.Run(), I tried to debug the application, and If I debug and run the code, the calculations are done correctly and inserted into the CSV file(even the first time when I run the application). I believe it's a thread issue but I'm not sure what the problem is.
  These are the 2 methods that are doing the calculations:</p>
  
  <pre><code> public  static double CalculateInterestRate(IBankingModel bm)
              {
                  Task.Run(() =&gt;
                  {
                      switch (bm.IsVariable)
                      {
                          case true:
                              InterestRate = (EURIBOR + FixedRateE) * bm.LoanAmount;
                              break;
                          case false:
                              InterestRate = bm.InterestPercent * bm.LoanAmount;
                              break;
                      }
                  });
                  return InterestRate;
              }
  
  public static double CalculatePrincipal(IBankingModel bm)
   {
              Task.Run(() =&gt;
              {
                  Principal = bm.LoanAmount - InterestRate;
              });           
  
              return Principal;
   } 
  </code></pre>
  
  <p>And this is the method that inserts the data:</p>
  
  <pre><code>[AllowAnonymous]
          [AcceptVerbs(HttpVerbs.Post)]
          public ActionResult Insert(BankingModel bm)
          {
              using (StreamWriter a = new StreamWriter(_path.MapPath, true))
              {
  
                  a.WriteLine($"{bm.PIN},{bm.Name},{bm.Surname},{bm.LoanAmount}," +
                      $"{bm.InterestPercent},{bm.IsVariable},{Matrix.CalculateInterestRate(bm).ToString()},{Matrix.CalculatePrincipal(bm).ToString()}");
  
              }
              return RedirectToAction("Main");
          }
  </code></pre>