question

LoveToCode-0935 avatar image
0 Votes"
LoveToCode-0935 asked LoveToCode-0935 answered

InvalidOperationsException (Vb.net)

I'm dealing with something strange - earlier I was able to list all my data in a list view control using the following code: Now after couple day I get an InvalidOperationsException.


         If wresults.WorkItems.Any Then
             'Dim wref As IEnumerable(Of WorkItemReference)
             LV_WIT.View = View.Details
             For wit = 0 To wresults.WorkItems.Count - 1
    
                 Debug.Print("Work Item id:-    " & wresults.WorkItems(wit).Id)  [This prints well]
                 LV_WIT.Items.Add(wresults(wit).Id) 
    
    
    
             Next
    
    
         End If
dotnet-visual-basic
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @LoveToCode-0935 ,
Check: some common causes of InvalidOperationException exceptions
Besides, in order to reproduce and analyze your problem, could you provide more related code here?

0 Votes 0 ·

1 Answer

LoveToCode-0935 avatar image
0 Votes"
LoveToCode-0935 answered

I figured that there was a overlap of two API's one after the other, which was causing this exception. So once I removed the other declaration it was all back to normal.




  Dim results = Await WClient.QueryByWiqlAsync(Query)
  Dim f = Await WClient.GetWorkItemAsync(11).ConfigureAwait(False) '(this was the problematic declaration as they were under the same thread I believe. Once I removed it, everything was ok
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.