Cancel a LinqPad query while it renders

牧云@^-^@ 提交于 2019-12-12 02:46:09

问题


Every now and then when I write LinqPad queries I forget how complex some of my database objects are. This can result in a query that runs quickly (< 5 secs) but then takes longer (>5 mins) to render the results to the output window. While this is happening the entire LinqPad UI becomes unresponsive.

You can cancel a query before it returns from the DB using the 'stop' button, but is there a way to cancel the rendering of the result set if I feel that it is taking too long?

I thought that if I used the .Dump(int depth) overload, that this might reduce the rendering involved in numerous table relationships, but I quickly realized that this is done by default. (even so you'd have to remember to always use this)

Is there some more elegant way of cancelling the rendering operation, other than killing linqpad or waiting for it to come back?


回答1:


I've reproduced the problem you describe. The LINQPad UI becomes temporarily unresponsive, and this occurs when the embedded WebBrowser control which displays the results is given a large and complex document to resolve.

This should be resolved as of v4.50.02 (in beta at time of writing). LINQPad now keeps track of the total number of objects visited when rendering the object graph. Upon exceeding a threshold, the nesting depth is automatically wound back, keeping the resultant HTML small enough that the WebBrowser shouldn't freeze for more than a second or two when first rendering.



来源:https://stackoverflow.com/questions/23756114/cancel-a-linqpad-query-while-it-renders

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!