System.InvalidOperationException: LinkedList is empty

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply
quimeraec
Posts: 6
Joined: Fri 25 Jun 2010 00:26
Location: Sud America

System.InvalidOperationException: LinkedList is empty

Post by quimeraec » Fri 13 Aug 2010 04:36

Hello.

I have a problem that appears randomly before execute a query using a simple routine (MySQLConnection+MySQLCommand+MySQLReader). The exception that I can't control is:

System.Transactions Critical: 0 : http://msdn.microsoft.com/TraceCodes/Sy ... /Unhandled
Excepción no controlada(Unhandled exception)
WS2.vshost.exe
System.InvalidOperationException, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
LinkedList is empty.
in System.Collections.Generic.LinkedList`1.RemoveFirst()

in Devart.Common.z.a()
in System.Threading.ThreadHelper.ThreadStart_Context(Object state)
in System.Threading.ExecutionContext.runTryCode(Object userData)
in System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
in System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
in System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
in System.Threading.ThreadHelper.ThreadStart()System.InvalidOperationException: LinkedList está vacía.(LinkedList is empty)
in System.Collections.Generic.LinkedList`1.RemoveFirst()
in Devart.Common.z.a()
in System.Threading.ThreadHelper.ThreadStart_Context(Object state)
in System.Threading.ExecutionContext.runTryCode(Object userData)
in System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
in System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
in System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
in System.Threading.ThreadHelper.ThreadStart()


Notes:
* Visual Studio 2008 version 9.0.30729.1 SP1
* .Net Framework 3.5 SP1
* Windows 7 Ultimate


I'll appreciate your help.

Best regards

Victor

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Mon 16 Aug 2010 14:01

Could you please describe the scenario you are trying to perform in more details? In particular, please specify (at least roughly) the SQL command you are executing and the way you are using the components mentioned. If possible, please send us a complete test project with which the problem can be reproduced; please include the scripts needed to create the database objects in this case. We couldn't reproduce the issue in our environment.

Does this exception have an inner one? If yes, could you please specify its message and stack trace?

Also, what exact versions of dotConnect for MySQL and MySQL server are you using?

quimeraec
Posts: 6
Joined: Fri 25 Jun 2010 00:26
Location: Sud America

System.InvalidOperationException: LinkedList is empty

Post by quimeraec » Mon 16 Aug 2010 15:16

Thank you very much for your reply. I'm trying to isolate the code that is associated with the error to send to you. I think however, that the problem is "very" random, usually associated with the execution of code as follows:

Public Sub FillWithItemsCB( _
ByVal trgControl As System.Windows.Forms.ComboBox, _
ByVal pMySqlCommand As String, _
ByVal pHost As String, _
ByVal pUser As String, _
ByVal pPass As String, _
ByVal pPort As String)


Dim inDBCon As New MySqlConnection 'Conexión
Dim inCommand As New MySqlCommand 'Comando
Dim inReader As MySqlDataReader 'Lector
Dim inSuccess As Boolean = False 'Marcador de éxito


'Preparando la conexión
With inDBCon
.Host = pHost
.UserId = pUser
.Password = pPass
.Port = pPort
.Database = Const_DB
End With

'Preparando el comando
With inCommand
.CommandText = pMySqlCommand
End With

'Limpiando datos
With trgControl
.Items.Clear()
End With

Try 'Primer nivel de prueba
inDBCon.Open()
inSuccess = True
Catch ex As Exception
inSuccess = False
Finally
Try 'Segundo nivel de prueba
'Ejecuto el comando contra el reader
inCommand.Connection = inDBCon
inReader = inCommand.ExecuteReader
inSuccess = True
Try
Do While inReader.Read
trgControl.Items.Add(inReader.Item(0))
Loop
Catch ex As Exception
Finally
inReader.Dispose()
End Try
Catch ex As Exception
Debug.Print(ex.Message)

Exit Try
End Try
End Try
End Sub


Scenario:
* My project has conventional controls, except for a TreeView control and another called Ultragrid (from Infragistics).
* According to my log, the problem was present before use such controls.
* I'm use the latest version of Devart
* The MySQL version is 5.1
* I could not handle the error through Try-Catch-End Try or using ON ERROR GOTO, then end execution.
* When I restart the program and performed the same steps, the error can occur again or not. It usually happens that the program works normally.
* SQL queries I use are quite simple. The last one caused a problem was:

SELECT p.codigo, c.descripcio
FROM pac_convenios p, con_convenio c
WHERE
p.codigo = c.codigo AND
c.vigencia = 1 AND
p.pac_id = 2


Best regards

Victor

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Tue 17 Aug 2010 12:04

Please specify at which point the error occurs (you can check this under debug). Also, please specify whether you are using the MySqlMonitor class in your application. If possible, please send us a test project with which the problem can be reproduced (at least sometimes).

We couldn't reproduce the problem in our environment.

gabriel.novy
Posts: 1
Joined: Thu 17 Feb 2011 15:58

Post by gabriel.novy » Thu 17 Feb 2011 16:05

Hi, anyone found a solution to this problem? I have the same throuble in my Silverlight aplication with almost the same StackTrace...

And like your application, not happens all the time... by this way is too dificult to find where the exception is throwing...

Here is my stack trace:
at System.Collections.Generic.LinkedList`1.RemoveFirst()
at Devart.Common.y.a()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Fri 18 Feb 2011 15:01

According to the stack trace, the problem may be related to the MySqlMonitor component. Please specify the way you are using (if you do) MySqlMonitor in your application or, if possible, send us a test project with which the issue can be reproduced.

Also, please try disabling MySqlMonitor to check whether the problem persists in this case.

Post Reply