Skip to content

Fix hang in AsyncLazy<T>.DisposeValue() when T : IAsyncDisposable#1271

Merged
AArnott merged 2 commits into
microsoft:mainfrom
AArnott:fixAsyncLazyDispose
Jan 6, 2024
Merged

Fix hang in AsyncLazy<T>.DisposeValue() when T : IAsyncDisposable#1271
AArnott merged 2 commits into
microsoft:mainfrom
AArnott:fixAsyncLazyDispose

Conversation

@AArnott

@AArnott AArnott commented Jan 5, 2024

Copy link
Copy Markdown
Member

AsyncLazy<T> had been clearing the JoinableTaskFactory field as soon as the value factory had completed. But with the introduction of DisposeValue(), we have a subsequent need of the JTF object to avoid deadlocks.

@AArnott AArnott added the bug label Jan 5, 2024
@AArnott AArnott added this to the v17.10 milestone Jan 5, 2024
@AArnott AArnott requested review from jdrobison and lifengl January 5, 2024 19:57
Comment thread src/Microsoft.VisualStudio.Threading/AsyncLazy`1.cs
Comment thread src/Microsoft.VisualStudio.Threading/AsyncLazy`1.cs
Comment thread src/Microsoft.VisualStudio.Threading/AsyncLazy`1.cs
`AsyncLazy<T>` had been clearing the `JoinableTaskFactory` field as soon as the value factory had completed. But with the introduction of `DisposeValue()`, we have a subsequent need of the JTF object to avoid deadlocks.
@AArnott AArnott force-pushed the fixAsyncLazyDispose branch from 5e65336 to 5544227 Compare January 6, 2024 02:04
@AArnott AArnott force-pushed the fixAsyncLazyDispose branch from eacdeb4 to d36f8f2 Compare January 6, 2024 02:35
@AArnott AArnott merged commit c51f4d2 into microsoft:main Jan 6, 2024
@AArnott AArnott deleted the fixAsyncLazyDispose branch January 6, 2024 02:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants