Friday, February 24, 2012

C# hanging for a very long time when working with SQL

I am designing a project using C#, SQL Express and VSTO.

Every time I change something in the database XSD display i.e add a query or create a new table adapter or configure an existing query, or just move the position of an existing table adapter, Visual Studio locks intself into a never ending loop with 100% processor activity (or 50% with dual processors). It stays in this state for about 4-5 hours and then come back to life.

Is there an option that I need to disable/enable to stop the program from doing this. I will appreciate your help.

Thanks,

Hammad

To my knowledge, VS did not put in an option to hang for 4-5 hours, but it you think they need one, let them know.

You're going to need to do some investigation to determine where the hang is comming from. Start by looking at the SQL error logs to see if anything is being registered during the hang time. Which logs you look at depend on where your database is stored. If the database is embedded in the project, then you're using a user instance and the logs are located at C:\Documents and Settings\<user>\Local Settings\Application Data\Microsoft\Microsoft SQL Server Data\SQLEXPRESS and 'SQLEXPRESS' is the name of your SQL Express instance. If you're using a database attached to the parent instance, then the log fles are in the default location of C:\Program Files\Microsoft SQL Server\MSSQL.#\MSSQL\LOG where # is the Instance ID associated with your copy of SQL Express. (If this is the only copy of SQL Server you have installed, it's 1).

If the logs don't show anything interesting, you might consider checking out one of the more general troubleshooting tools such as FileMon or RegMon (available from http://www.microsoft.com/technet/sysinternals/default.mspx) to track what is happening when you perform the action that is hanging VS. Often you can tell what the program is doing by looking at the file or registry keys being accessed. I would also suggest you ask this question on one of the VS forms as the problem is showing up in VS.

Mike

No comments:

Post a Comment