开发者

Scrolling the scrollbar of a ConsoleApplication hangs the thread

I've got some server apps that I've been trying to get some metrics from so I can debug them. I found that when scrolling back up the window I'd suddenly get ti开发者_如何学Gomeouts from the clients. Sure enough, moving the scrollbar stopped the application.

I'm probably missing something fundemental here, but I can't work out why moving the scrollbar on a Console window would block the thread.

It's very simple to reproduce:

Sub Main()
    Do
        Console.WriteLine(Now.ToString("O"))
        System.Threading.Thread.Sleep(1000)
    Loop
End Sub

Run that up, and any interaction with the window blocks the thread. In the example below, I just moved the scrollbar a bit and held it in position for a few seconds before releasing

Scrolling the scrollbar of a ConsoleApplication hangs the thread

http://www.briandrought.com/miscpics/scrollbar.png

I've tried it with a Timer type loop rather than a Thread.Sleep but the same issue appears. What am I doing wrong (other than not using a service instead!)?

Kind Regards,

Brian


You're not doing anything wrong. That's just how windows console apps behave. In normal operation your server apps would surely run as headless services so there should be no issue in production.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜