Last active
October 22, 2015 08:43
-
-
Save mstyura/d2b257c629e33f12adf4 to your computer and use it in GitHub Desktop.
Why there is no warning or even compilation error?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Threading.Tasks; | |
namespace AwaitAndElvis | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Run(null).Wait(); | |
} | |
private static async Task Run(Program p) | |
{ | |
var a = await p?.Async(); // <- NRE | |
} | |
public async Task<int> Async() | |
{ | |
return 5; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment