Hi!

I am working in some old code that we are moving into the world of async await. I have hit a problem with a class that notifies subscribers of status changes through RaiseEvent. The problem is that all the events are queued up on the caller side like this:


Code:
addhandler myWorker.ReportProgressEvent, addressof CollectProgress

dim result = await myWorker.DoWork

' Finished
Debug.Write(result.Message)

private sub CollectProgress(i as integer)

Debug.Write("status is:" & i)
end sub
What happens is that the async method is called, it does its work and raises 10 ReportProgressEvent and then finishes, and THEN the CollectProgress method is raised 10 times...


Is there a way to fix this behavior (easily)? I have looked into the Progress(of T) class, but not sure if it is overkill or not?

Any thoughts?

/H