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?