From 20768cebac30529a57face3a60b1a5aadf25714b Mon Sep 17 00:00:00 2001 From: moshferatu Date: Thu, 4 Jul 2024 19:38:47 -0700 Subject: [PATCH] Prevent concurrent access errors when iterating over news events during rendering --- indicators/News.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indicators/News.cs b/indicators/News.cs index 173c7be..3d3d486 100644 --- a/indicators/News.cs +++ b/indicators/News.cs @@ -234,7 +234,7 @@ namespace NinjaTrader.NinjaScript.Indicators // Draw news events. using (TextFormat eventTextFormat = EventFont.ToDirectWriteTextFormat()) { - foreach (var newsEvent in newsEvents) + foreach (var newsEvent in new List(newsEvents)) { var timeSize = MeasureString(newsEvent.Time, eventTextFormat); var currencySize = MeasureString(newsEvent.Currency, eventTextFormat);