ArgumentOutofRangeException
    Random r = new Random();
            int InvadorNumberA=r.Next(0,5);
            int randomShot = r.Next(5);
    
            List<Invaders> invadersShooting = new List<Invaders>();
            Invaders invaderA=new Invaders();
        
            var invaderByLocationX = from invadersSortByLocation in invaders
                                     group invadersSortByLocation by invadersSortByLocation.Location.Y
                                     into invaderGroup
                                     orderby invaderGroup.Key
                                     select invaderGroup;
    
           invadersShooting = invaderByLocationX.Last().ToList();
            
         try
           {
       
               invaderA = invadersShooting[InvadorNumberA];// constantly being thrown there. i cant catch the exception.. so i guess it is being thrown somewhere else. any idea on how i stop it from being thrown?
    
           }
            catch(ArgumentOutOfRangeException dd)
           {
               invaderA = invadersShooting[0];
           }
ArgumentOutofRangeException
===

    Random r = new Random();
            int InvadorNumberA=r.Next(0,5);
            int randomShot = r.Next(5);
    
            List<Invaders> invadersShooting = new List<Invaders>();
            Invaders invaderA=new Invaders();
        
            var invaderByLocationX = from invadersSortByLocation in invaders
                                     group invadersSortByLocation by invadersSortByLocation.Location.Y
                                     into invaderGroup
                                     orderby invaderGroup.Key
                                     select invaderGroup;
    
           invadersShooting = invaderByLocationX.Last().ToList();
            
         try
           {
       
               invaderA = invadersShooting[InvadorNumberA];// constantly being thrown there. i cant catch the exception.. so i guess it is being thrown somewhere else. any idea on how i stop it from being thrown?
    
           }
            catch(ArgumentOutOfRangeException dd)
           {
               invaderA = invadersShooting[0];
           }