Move to WpfFact for indentation tests.
Here's why we need this: This set of commits changes SplitString and Indentation to use a synchronous path for getting a syntax tree. This is so that those features willblock hte UI thread for as small an amount of time as possible. *However*, it's not always the case that they actually get the syntax tree synchronously. in order for them to get the tree, they need to call AsyncLazy.GetValue to actually get the value. However, AsyncLazy.GetValue will not actually perform synchronously if there is an existing async request already in flight. In practice that can happen because the background parser ends up kicking off work to try to get the syntax tree asynchronously. Because of this, when we call into get the tree synchronously the asynclazy actually has us wait on the async work that is in flight. In tests this causes us to assert because we're blocking on async work on a non-UI thread. We had two options here: 1. Change AsyncLazy to not wait on the async work here and instead go execute the work synchronously. 2. Change teh tests to be WpfFact Jason and I discussed hte first option but decided against it. Changing async lazy has huge downstream ramifications and we weren't comfortable just changing it's behavior in that manner. Note: during tests we found 99% of the time, we did go through the sync path. So, ideally, the impact of us blocking the UI thread on async work is minimal in practice.
Showing
想要评论请 注册 或 登录