I developed a Windows Service with EntityFramework for data access and it works perfectly. Now I'm trying to migrate it into a console app, but it's crashing when using "Database.SqlQuery<>". It doesn't give any error or exception, it just closes the console window and stops the execution.
Here's the code I'm using:
public async static Task<IList<SqlData>> GetDbInfo()
{
    var context = new dbEntities();
    IList<SqlData> data = await context.Database.SqlQuery<SqlData>(ConfigurationManager.AppSettings[Properties.Resources.Select]).ToListAsync();
    return data;
}
It works perfectly fine in Windows Service, I didn't change anything. Does anyone know what could be happening?
UPDATE
My entire code as requested:
static void Main(string[] args)
{
  logger.Info("Init of Main");
  WriteFile();
  logger.Info("End of Main");
}
protected static async void WriteFile()
{
  logger.Info("Init of WriteFile");
  StreamWriter file = null;
  string path = TxtUtils.GenerateOutputFilePath();
  IList<SqlData> data;
  int affectedRows = 0;
  try
  {
    data = await DataAccess.GetDbInfo();
    if (data != null && data.Count > 0)
    {
      ...
    }
  }
  catch (Exception ex)
  {
    logger.Error("Fail in process", ex);
  }
}
I read this answer, as @PalleDue said:
That took here:
https://blogs.msdn.microsoft.com/mazhou/2017/05/30/c-7-series-part-2-async-main/
I've tried what it says there:
public static asyn Task Main(string[] args)
{
  await ...
}
But Visual Studio says it's not a correct entry function.
