U
Uchiha Jax
I had a bug, code kept stopping without any warning.
I'd put a breakpoint on say line 3 and line 8. 3 would trigger but the
breakpoint on line 8 would never trigger.
After trying a few things I figured an exception must be happening and tried
it within a try catch, true enough I got an exception.
This confuses me, I always thought that if an unhandled exception occured
the program would crash out informing me of the problem rather than
continuing but not running properly.
The code that was causing the exception was this silly method:
public ArrayList GetRatings(ArrayList users, Rating.RatingType rType, int
id)
{
ArrayList ratings = new ArrayList();
foreach(RatingRow rRow in Rating.Rows)
{
if(rRow.RatingType == Convert.ToInt32(rType) && rRow.RatedID == id)
{
ratings.Add(rRow);
}
}
foreach(User u in users)
{
foreach(RatingRow rRow in ratings)
{
ratings.Add(CreateRating(rRow)); //// Enumeration exception here
}
}
return ratings;
}
Is there any reason why the program would not crash out when this exception
occured and wasn't handled?
I'd put a breakpoint on say line 3 and line 8. 3 would trigger but the
breakpoint on line 8 would never trigger.
After trying a few things I figured an exception must be happening and tried
it within a try catch, true enough I got an exception.
This confuses me, I always thought that if an unhandled exception occured
the program would crash out informing me of the problem rather than
continuing but not running properly.
The code that was causing the exception was this silly method:
public ArrayList GetRatings(ArrayList users, Rating.RatingType rType, int
id)
{
ArrayList ratings = new ArrayList();
foreach(RatingRow rRow in Rating.Rows)
{
if(rRow.RatingType == Convert.ToInt32(rType) && rRow.RatedID == id)
{
ratings.Add(rRow);
}
}
foreach(User u in users)
{
foreach(RatingRow rRow in ratings)
{
ratings.Add(CreateRating(rRow)); //// Enumeration exception here
}
}
return ratings;
}
Is there any reason why the program would not crash out when this exception
occured and wasn't handled?