Not sure what is causing: crashed with error "Unable to invoke target method in current thread. Use `BeginInvokeOnMainThread` method to prevent this error."

Created at 16 Mar 2023, 06:47
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
HO

HOMERUN

Joined 18.11.2015

Not sure what is causing: crashed with error "Unable to invoke target method in current thread. Use `BeginInvokeOnMainThread` method to prevent this error."
16 Mar 2023, 06:47



Creating the a custom indicator. Usually it works normally when attaching it to a single chart.

The indicator is using basic C# and List to store some data and calling cTrader APIs, pretty sure there is no threading stuff in the code.

These errors occur when using this indicator on multiple charts AND starting them simultaneously. (like when restarting cTrader and every charts load this indicator)



Restarting the indicator 1-by-1 on every chart and it works again without error. so I suspect it has to do with something that it using at the same time?

 

Thanks, Please let me know if anything.


@HOMERUN
Replies

firemyst
01 Jun 2023, 05:53

WEll, there may be an issue in cTrader, there may be an issue with your code.

Nobody will be able to help identify the issue unless you post some code that reproduces the issue.


@firemyst