Fixes in AnalyzerDriver
This fixes a couple of minor issues with AnalyzerDriver.
1. The compilation process was always shutting down with two first
chance exceptions. The code would unconditionally loop an await
DequeueAsync calls which results in a TaskCanceledException when the
CompilationEventQueue is completed. That exception was then rethrown to
the calling method.
This is not wrong but it significantly hinders the debugging experience
in Visual Studio (exceptions result in dialogs + pauses). And the
second throw essentially amounts to using exceptions as control flow.
I changed the code to stop looping when there was no potential for
future data from the CompilationEventQueue. If the queue is completed
and has zero entries then no more data will ever be added and calling
DequeueAsync is wasted processing. This is the normal shut down
sequence for the compiler.
2. The exception handling code covered two methods: DequeueAsync and
ProcessEventAsync. It assumed that TaskCanceledException always came
from DequeueAsync. If ProcessEventAsync ever threw a
TaskCanceledException the event loop logic would be incorrect. Changed
the handling to be separate for each call.
***NO_CI***
(changeset 1390329)
↧