You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are multiple overloads of PartDiscovery.CreatePartsAsync, that may use CreateAssemblyDiscoveryBlockChain or CreateDiscoveryBlockChain. Evidently, these chain-building methods' use of CancellationToken is not reliable, and it seems cancellation will abort the dataflow but may still return a 'successful' result, causing an incomplete collection of parts to be returned, and potentially an incomplete cache to be written, corrupting this and future sessions.
We should make sure the CancellationToken is set for every dataflow block that we create.
We should also verify (through automated testing and debugger inspection) that if cancellation aborts a dataflow, that an exception will propagate. If we cannot guarantee that, we should add a cancellationToken.ThrowIfCancellationRequested(); call at the end of each of the CreatePartsAsync methods.
Let's take both approaches: ensure CancellationToken is set for all dataflow blocks, and throw explicitly at the end of each of the public methods based on cancellation.