You cannot βuseβ when using βwaitβ. The reason is how the compiler converts your C # wait / asynchronously to IL. You can decompile it.
When the processor reaches:
await writer.StoreAsync();
in fact, he immediately returns to the caller (see IL). Since you use "use", the Dispose interface is called "IRandomAccessStream fs and the resources are freed. These resources are required by the thread initiated in" StoreAsync ".
For this reason, you must invoke Dispose explicitly after waiting.
The same problem occurs in try / exception / catch blocks.
source share