Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 704819
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:59:03+00:00 2026-05-14T03:59:03+00:00

I have an StackOverflowException in one of my DB functions that I don’t know

  • 0

I have an StackOverflowException in one of my DB functions that I don’t know how to deal with. I have a SQLite database with one table “tblEmployees” that holds records for each employees (several thousand posts) and usually this function runs without any problem.

But sometimes after the the function is called a thousand times it breaks with an StackOverflowException at the line “ReturnTable.Load(reader)” with the message: An unhandled exception of type ‘System.StackOverflowException’ occurred in System.Data.SQLite.dll

If I restart the application it has no problem to continue with the exact same post it last crashed on. I can also make the exactly same DB-call from SQLite Admin at the crash time without no problems.

Here is the code:

Public Function GetNextEmployeeInQueue() As String
    Dim NextEmployeeInQueue As String = Nothing
    Dim query As [String] = "SELECT FirstName FROM tblEmployees WHERE Checked=0 LIMIT 1;"
    Try
        Dim ReturnTable As New DataTable()
        Dim mycommand As New SQLiteCommand(cnn)
        mycommand.CommandText = query
        Dim reader As SQLiteDataReader = mycommand.ExecuteReader()
        ReturnTable.Load(reader)
        reader.Close()
        If ReturnTable.Rows.Count > 0 Then
            NextEmployeeInQueue = ReturnTable.Rows(0)("FirstName").ToString()
        Else
            MsgBox("No more employees found in queue")
        End If
    Catch fail As Exception
        MessageBox.Show("Error: " & fail.Message.ToString())
    End Try
    If NextEmployeeInQueue IsNot Nothing Then
        Return NextEmployeeInQueue
    Else
        Return "No more records in queue"
    End If
End Function

When crashes, the reader has “Property evaluation failed.” in all values.

I assume there is some problem with allocated memory that isn’t released correctly, but can’t figure out what object it’s all about. The DB-connection opens when the DB-class object is created and closes on main form Dispose.

Should I maybe dispose the mycommand object every time in a finally block? But wouldn’t that result in a closed DB-connection?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T03:59:03+00:00Added an answer on May 14, 2026 at 3:59 am

    It’s hard to be sure without the stack trace, but I’d imagine that somewhere you have a recursive call to a function that increases the call stack size on each iteration. The StackOverflowException error comes from the SQLite library, but I suspect that most of the calls on the stack at this point are your own functions. The call into the SQLite library was the call that broke the camel’s back, but that’s not necessarily where the error is.

    Post the (interesting parts of the) stack trace and perhaps we can tell you more precisely where your error is.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have discovered that one of our auto generated assemblies is throwing a StackOverflowException
I have some C# code that is giving a StackOverflowException when running under IIS7
i have some big xslt crashing iis (StackOverflowException) when loading an XslCompiledTransform while the
I have few columns in my DataGridView, one of them is an unbound column
I have a view that is not strongly typed. However I have in this
In my application, I have 2 list activities which can start one or the
My activity implements OnTouchListener and it have one ListView inside it. When user touch
I have a managed code Windows Service application that is crashing occasionally in production
I have a User class that has a property called Creator which is of
I have a C# DirectShow.net program that i created on a windows 7 32bit

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.