Skip to content

Instantly share code, notes, and snippets.

@idg10
Created September 19, 2018 05:55
Show Gist options
  • Save idg10/9739b7358b65b496ecfa7758bf595557 to your computer and use it in GitHub Desktop.
Save idg10/9739b7358b65b496ecfa7758bf595557 to your computer and use it in GitHub Desktop.
Incorrect resource handling with Task-based deferred execution
// This doesn't work.
public static Task<string> GetContentAsync(string configPath)
{
using (var reader = new StreamReader(configPath))
{
return reader.ReadToEndAsync();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment