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 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 cannot get this modal dialog to work property. Problem is that in a
I cannot get my Spring web app to find my scripts. I have the
I cannot get this function to fire off... I'm thinking I need a fresh
ColorPickerDialog.OnColorChangedListener cannot be resolved to a type is the error i get in Eclipse
what's weird about my error is that it ONLY occurs in the firefox extension
I cannot get my Wordpress theme to randomise the posts I'm displaying in the
I cannot get my SID working ... <?php session_start(); // Or maybe pass along
I cannot get Bindable LINQ to work with VB.NET for the life of me.
I cannot get the background to stretch behind the contentbox. The strange thing is,
I cannot get the jQuery slideDown function to work on <table> elements. They just

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.