Menu

CCacheEntry:Find I think. It's Bug For VB.Net

2004-08-30
2004-08-31
  • Nobody/Anonymous

    I Currently Use AtomsFramework 0.1.8
    I'm not. Is it a bug only for vb.net ?

    Public Function Find(.....) As .....
    .
    .
    For Each x In Me
    .
    .
            If ce.IsExpired(interval) And Not ce.PersistentObject.IsDirty Then

              Debug.WriteLine("Cache - Removing expired object from cache during Find()")
                        MyBase.Remove(x.Key)
            Else
    .
    .
    Next x

    I got a Error When Cache Expire.
    I Change To

        Dim Remove_List As New ArrayList
        For Each x In Me
    .
    .
            If ce.IsExpired(interval) And Not ce.PersistentObject.IsDirty Then
              Debug.WriteLine("Cache - Removing expired object from cache during Find()")
                        Remove_List.Add(x)
                        'MyBase.Remove(x.Key) 'delete object from cache Remark By Leng 20040701
            Else
    .
    .
            Next x
            '   Start Add By Leng 20040701
            For Each x In Remove_List
                MyBase.Remove(x.Key)
            Next
            '   Start End By Leng 20040701

     
    • Richard Banks

      Richard Banks - 2004-08-31

      Hi Leng,

      It's not actually a VB.NET bug, but rather a bug in the way I was clearing items from the collection.  You can't actually remove items from a collection without it invalidating the iterator for the collection.

      Your code is very appreciated (as always), however I've already fixed this problem in the current version (I can't remember if the fix is in 1.22 or only in CVS).  In either case v0.1.8 is quite old now and I would recommend that you update to the latest version when you get a chance.

      - Richard.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.