I\'m investigating Microsoft enterprise library (data application block) -- The samples sln.
They have a sample of reading data asynchronously ( IA
The reason you see ReSharper's warnings is that ReSharper's code flow analysis engine is not strong enough to see what is going on: they assume that your code could get to the end of the using
clause without doneWaitingEvent
being set, which is not possible due to a while
loop:
while (!doneWaitingEvent.WaitOne(1000)) {
Console.Write("Waiting... ");
}
The loop will keep printing the "Waiting... "
line until doneWaitingEvent.Set();
gets called, preventing your code from reaching the end of the using
block. Same goes for the other warning.
Long story short, this warning can be safely ignored. Add ReSharper's "ignore this warning" comments, and optionally file a bug report with them.