views:

299

answers:

1

We have some customers using our .NET 2.0 thick-client app that experience strange, intermittent errors reading data from a SQL 2000 SP4 Server, where the actions succeeded just moments earlier. We have some customers using SQL 2000 (and many using 2005) where these errors do not occur.

One thing I notice is that the app in our testing environments references System.Data 2.0.50727.3053; whereas the app references 2.0.50727.1433 on the customer's systems. What is the difference between these two revisions and could it be related to the errors described below?

Here is an example of the error's stack trace where the enumeration value is 8, but I have plenty more instances where the "out of bounds" enumeration value is 4 or 14 with the same exact stack trace. Are the enumeration values findable sometimes but not at other times? What about when the same portion of the app runs without errors?

TYPE: System.ArgumentOutOfRangeException
MSG: The SqlDbType enumeration value, 8, is invalid.
Parameter name: SqlDbType
SOURCE: System.Data
SITE: GetSqlDataType

at System.Data.SqlClient.MetaType.GetSqlDataType(Int32 tdsType, UInt32 userType, Int32 length)
at System.Data.SqlClient.TdsParser.CommonProcessMetaData(TdsParserStateObject stateObj, _SqlMetaData col)
at System.Data.SqlClient.TdsParser.ProcessMetaData(Int32 cColumns, TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.NextResult()
at Ceoimage.Basecamp.Data.Document._GetDocumentModelWithCollections(IDataReader rdr)

Update: I just downloaded System.Data from one of the clients' workstations. They had two versions in the GAC, one in the GAC directory and one in the GAC_32 directory. In GAC, the version number is 1.14322.2365. In GAC_32, the version number is 2.0.50727.1433 as described above. In all three versions, however, the SqlDbType enumerable maps the same int values to the same types for those in the error messages:

DateTime = 4
Int = 8
UniqueIdentifier = 14

I am afraid the version might be a red herring: if the problem has to do with framework versions, shouldn't the problem happen 100% of the time rather than being transient?

+2  A: 

Your client is on .NET 2.0 without 3.5 installed. Your test servers are 3.5. The only things added to the enumeration in 3.5 are:

Structured
Date
Time
DateTime2
DateTimeOffset

This does not mean that there are not some underlying changes.

If possible, I would test the app under 2.0 without 3.5 installed and see what errors you are getting. That should give you a good place to start.

To figure out the point of error, I would have to iterate through the enumeration and see what order the items are in the enum. Reflector is a great tool for doing this, but you will have to do it on both a 2.0 system and a 3.5 system to see the changes.

Gregory A Beamer
Thanks for the good start. Looking at Reflector, SqlDbType with the value of 8 is Int. My app would not work a lick if it has trouble reading Ints from the database. How in the world does it happen and how can it be so transient if it is tied to the framework version?
flipdoubt