Skip to content

在wpf命令里使用了await为什么还会阻塞ui | probie's blog #45

Description

@probieLuo

https://probieluo.github.io/posts/wpf-command-await-block-ui/

在最近在开发中遇到个很有意思的问题,我在一个命令里面使用了一些sql执行操作,虽然这些sql执行都使用了await等待sql耗时操作,但ui还是阻塞了,百思不得其解,思考了半天问了我们组长,组长说在await执行完成后还是会回到ui线程,最好把这些与ui无关代码的用task.run包起来,放在后台线程。 虽然问题成功得到了解决,但对await阻塞了ui线程这个问题还是不解,我们知道await让出了

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions