0

This api was accessed with arguments from the wrong context

Niteen 5 years ago in Question updated 5 years ago 1
Hello,

We are adding and removing the ModelVisual3D object using background worker process and we got the the following error message:

Error : "This api was accessed with arguments from the wrong context"

Here is my code:

Private Sub backgroundWorker_ProgressChanged(sender As Object, e As ProgressChangedEventArgs)

Dim list = helixViewport3D.Children.OfType(Of ModelVisual3D).ToList()
For Each item As ModelVisual3D In list
If TypeOf item Is ModelVisual3D AndAlso item.GetName() = "Mesh" Then
helixViewport3D.Children.Remove(item)
End If
Next
Dim visual = CType(e.UserState, ModelVisual3D)
helixViewport3D.Children.Add(visual)
End Sub

We are used the BackgroundWorker thread to update the UI from background process. Can you please suggest how to solve this issue.

Please find the attached screem shot.


Thanks,
Niteen Patil







Please find the attached screen shot for above message.


Please suggest the solution.

Thanks,