I am running queries using Management Studio (2008 RTM) against a remote SQL Server 2005 instance (9.0.3050). When trying to run a query like SELECT * FROM sys.databases, I am getting strange errors that interrupt the retrieval of results. Typically 5 rows will come back, and then SSMS will stop processing the query, move to the error pane, and show an error like this:
An error occurred while executing batch. Error message is: Invalid array size.
An error occurred while executing batch. Error message is: Internal connection fatal error.
An error occurred while executing batch. Error message is: Non-negative number required.
Parameter name: count
I have a suspicion that this has something to do with network protocols, because if I connect to my VPN and route to the remote server that way, everything works fine. If I disconnect from the VPN, the errors return. Opening a new SSMS instance does not help.
I don't necessarily want you to try to fix my issue, because I understand that this is not going to be an easy one to reproduce. But I think we need a better way to debug these things on the client side. In the short term, can you describe to me what part of the code path would have to be hit, in order for these error messages to be returned from SSMS? Obviously those error messages were coded by someone, to be returned for a specific event. This knowledge would allow me to debug the problem myself, assuming it is not isolated to the internals of SSMS.
In the long term, can I suggest some kind of logging mechanism for SSMS, so that when it comes across errors and other events, they can be logged somewhere with more diagnostic information? This would allow for easier debugging and would provide evidence that is better than a screen shot. I imagine I will file a separate enhancement suggestion for that one.
Thanks for listening,
Aaron Bertrand, SQL Server MVP