Unfortunately none of the above solved the same problem for me. I eventually built a new project with minimal dependencies, and still got the error with the same integer variable, but after commenting out various sections of code was able to track down to use of lambda expression in
which was using the integer variable. Aha - original problem above is using a lambda expression!
To illustrate, the problematic variable is "x". Integers before and after did not cause problems. I could step past this variable (x) after commenting out everywhere that it was subsequently used within the sub:
Public Sub ProcessNotifications()
Dim assetList As New List(Of AssetInfo)
Using reader As SqlDataReader = _dbUtils.GetNotificationSummary()
If reader.HasRows Then
Dim notificationId As Integer = 0
Dim x As Integer = 0
Dim skywaveId As Integer = 0
Dim ai As AssetInfo = Nothing
Dim msg As MsgResponse = Nothing
As I uncommented different sections, the culprit further down was:
ai = assetList.Find(Function(p) p.AssetId = x)
Obvious work-around is to change to loop
for i = 0 to assetList.count - 1
Seems like karnayanar (11-Jan-13 14:23pm above) was thinking about this too.
Would be nice to know why it is happening.... collections.generic is part of mscorlib which is part of .Net project, and all of my referenced projects are using same .Net framework (4.5.1).
Anyone else have any ideas?