C# - Program does not contain a static - Main method for entry point
When working with Async method, you often bump into the following issues. Not all code are made 'async'.
There are 2 workarounds which are shown here.
public static void Main(string[] args) { MyProgram(args).RunAsync().GetAwaiter().GetResult(); }
Or with code below which does not return result (void operation)
public static void Main(string[] args) { BuildWebHost(args).RunAsync().Wait(); }
If you're just going to return Task
public async Task
{
return await Task.FromResult
}
Comments