Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Unhandled Exception with Custom Add-OnCross-thread Operation
Collapse
X
-
Unhandled Exception with Custom Add-OnCross-thread Operation
I’ve been developing a custom add-on that uses multiple threads to handle real-time data processing. However, I keep running into a 'Cross-thread operation not valid' error when trying to update UI components from a background thread. I’m aware this might be related to NinjaTrader’s threading model, but I’m unsure how to properly implement a solution to safely interact with UI components from a non-UI thread. Any guidance on handling NinjaTrader's thread safety model in custom add-ons?Tags: None
-
Hello mukeshbhardwaj,
Welcome to the NinjaTrader forums!
Custom threading is an advanced C# concept and is not fully supported by the Scripting Support team.
There can be limitations using unsupported code and advanced C# concepts in a NinjaScript, so your mileage may vary. As of now, we do not have any examples that can be used to navigate that path.
That said, be sure you are using on object's dispatcher with <object>.Dispatcher.Invoke.Async().
Help guide: NinjaScript > Educational Resources > Multi-Threading Consideration for NinjaScript
Help guide: NinjaScript > NinjaScript Best Practices > Error handling practices > Modifying UI elements and multi-threadingChelsea B.NinjaTrader Customer Service
- Likes 1
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by kenz987, Today, 12:34 PM
|
0 responses
1 view
0 likes
|
Last Post
by kenz987
Today, 12:34 PM
|
||
Started by sgordet, Today, 07:56 AM
|
1 response
20 views
0 likes
|
Last Post Today, 12:30 PM | ||
Started by trdninstyle, 11-26-2024, 12:23 PM
|
77 responses
244 views
0 likes
|
Last Post
by trdninstyle
Today, 12:22 PM
|
||
Started by AgriTrdr, Today, 10:35 AM
|
2 responses
17 views
0 likes
|
Last Post
by AgriTrdr
Today, 12:19 PM
|
||
Started by Elevator2TheTop, Today, 11:30 AM
|
1 response
13 views
0 likes
|
Last Post Today, 12:18 PM |
Comment