I have a similar problem. I sent one case with the bug report tool. In this case the code which had the error was long and complicated, but I could narrow it down to:
Quote: Private Class SomeClass
Public Property SomeIntProperty As Integer
Public Property SomeOtherIntProperty As Integer
Public Property SomeBooleanProperty As Boolean
Public Property SomeStringProperty As String
End Class
Private Sub Test()
Dim someUnusedVar As Integer
Dim dict As New Dictionary(Of String, List(Of SomeClass))
Dim enumerable As IEnumerable(Of SomeClass)
Dim anotherUnusedVar As Integer
For Each enumerableItem In enumerable
Dim list As List(Of SomeClass)
For Each listItem In list
Dim oneMoreUnusedVar As Integer = 3
Dim cl As New SomeClass
If 1 >= cl.SomeIntProperty Then
Dim otherObj As New SomeClass
otherObj.SomeIntProperty = 0
otherObj.SomeBooleanProperty = (1 <= cl.SomeOtherIntProperty)
dict(enumerableItem.SomeStringProperty).Add(otherObj)
End If
Next
Next
End Sub
If I remove any of the unused vars, I don't get the error anymore. Weird.