Beta: Util.CompileAsync - await operator
Hi,
I am trying to use the new CompileAsync method (from within LinqPad v4.53.16), but the following code
throws this exception:
Any ideas why this is not working?
I am trying to use the new CompileAsync method (from within LinqPad v4.53.16), but the following code
void Main()
{
var q = await Util.CompileAsync("ScriptPath.linq");
}
throws this exception:
The 'await' operator can only be used within an async method. Consider marking this method with the 'async' modifier and changing its return type to 'Task'.
Any ideas why this is not working?
Comments
In a normal Visual Studio project, the main method cannot be marked as async. But because LINQPad is a scratchpad (a hosted environment), the rules have been relaxed to improve the experience.
I would have never thought of making the main method async :-)