问题
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