Control.Invoke is hanging

前端 未结 2 1358
刺人心
刺人心 2020-12-07 00:05

I\'ve seen a ton of post regarding the problem of control.Invoke hanging applications but they mostly seemed to be restricted to those running on .NET 1.1. I\'ve also seen

2条回答
  •  离开以前
    2020-12-07 00:15

    You are using Thread.Join to let the UI thread pause until the other thread is done. At the same time you use Control.Invoke to let the UI thread do some action. This won't work because the UI thread is waiting for the other thread to finish.

    I would suggest you either remove the Thread.Join call or do your action in the UI thread if you want it to wait for the action to finish.

提交回复
热议问题