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

  • Home
  • SEARCH
  • 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 630407
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T19:51:06+00:00 2026-05-13T19:51:06+00:00

I cannot get to the bottom of this error because it happens only in

  • 0

I cannot get to the bottom of this error because it happens only in one instance, and I can’t find any code that can be the cause of the error.

I have a 3.5 web service that I’m calling from a multi-threaded, CAB client. I have a bunch of unit tests against the web service (from both 3.5 and 2.0 code), and it works fine. However, in the actual application, it doesn’t work 90% of the time and, the remaining 10% of the time, it decides to work.

The code:

Friend Function ExecuteSearch(ByVal query As String) As List(Of SomeObject)
    Dim searchResults As List(of Object) = _searcher.UserSearch(query)
    Return searchResults
End Function 

// In Searcher
Public Function UserSearch(ByVal query As String) As List(Of SomeObject)
    Return Translate(Search.GetResults(query))
End Function

// In Search
Public Function GetResults(ByVal query As String) As List(Of SomeObject)
    Dim service As New FinderService.FinderService()
    Dim results As New List(Of String)
    Dim serviceResults As IEnumerable(Of String) = service.Search(query)    // <-- ERRORS OUT HERE 

    results.AddRange(serviceResults)

    Return results
End Function

// In the service
Public Function Search(ByVal query As String) As IEnumerable(Of String)
        Initialize() // Initializes the _accounts variable
        Dim results As New List(of String)
        For Each account As User In _accounts
            If a bunch of conditions Then
                results.Add(account.Name)
            End IF 
        End For 

        Return results 
End Function 

The breakpoints hit these codes (in this order). The line that errors out is in the “GetResults” method.

Any help would be appreciated.

  • 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-13T19:51:06+00:00Added an answer on May 13, 2026 at 7:51 pm

    Ah, the Heisenbugs 😀

    Apparently _accounts get modified during the loop. You can alleviate it by doing

    For Each account As User In _accounts.ToList()
    

    so a copy of current _accounts is created and enumerated and not the actual collection that might change

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

Sidebar

Related Questions

I am using this LightBox on http://sbc.mojopin.co.uk/portfolio.php and just cannot get it to work.
So who doesn't have issues with ie7 ? It seems that I cannot get
I have a line chart in a report (rdlc), that I cannot get formatted
I have downloaded CVtypes and tried the example scripts with it but cannot get
I'm trying to get a PDF page that is within the context of my
I'm a beginner and have just about managed to put together this website with
Dear all, this is going to be tough: I have created a game object
I need to get content from a site I need to get /html/body/div/div[2]/table/tbody/tr/td/div/div[2]/form/fieldset[2]/table[2] or
So I've been trying to add some AJAX to my home page with rjs
I have just started developing in Android and I am trying to make a

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.