InvokeAsync is awaitable and nothing in the OnBarUpdate chain of calls is asynchronous out of the box (Task never appears as a return type in any of the strategy code I've been working with). Therefore, telling anyone that InvokeAsync() is the way to go is not going to work for the strategy specializations. You have to make the code complete its work or you will be left with half-baked oddities in the UI.
For this reason, MS provides Invoke(), which is intended for NT's synchronous OnBarUpdate calls. Invoke() is the correct use case for situations where the UI thread is needed to update a widget already drawn on a chart. ChatGPT and other LLMs give a good explanation for why this is the case.
Obviously, using InvokeAsync() is going to cause all sorts of issues if no await keyword is used. I ran into this while trying to paint the diamond of a previous bar with a specific color. Some diamonds got the color, some don't because obviously the thread is not necessarily running to completion on each call. It's not properly awaited. Reloading the strategy yields a random completion for the same exact diamonds/bars.
I've noticed the NT UI gets into freeze issues whenever Invoke() is used. Something smells off about its behavior in situations where a simple UI update is needed. I must be doing something wrong and have not found anything in the documentation on multi-threading.
Please provide a pointer. I've used the ChartControl's Dispatcher as well as the application current's version with no luck.

Comment