An unhandled exception of type 'System.AccessViolationException' occurred in SharpDX.Direct2D1.dll
I am working on an expanded price alert indicator and I think it may be related to the Draw.Text function I am using to update a price label on my horizontal line.
I have it set to update every 200ms according to a timer elapsed event. It works great and it follows the line when it is moved by the user. But I have been noticing more crashes of this type since I added this feature.
Every 200ms I do:
private void setPriceLevelLabel()
{
if (ShowPriceMarker)
{
SimpleFont font = new SimpleFont("Courier New", 12) { Size = PriceMarkerTextSize, Bold = true };
Draw.Text(
this,
"PriceMarker",
true,
Instrument.MasterInstrument.RoundToTickSize(currentPrice).ToString(),
PriceMarkerBarsAgo,
currentPrice,
(PriceMarkerPlacement == AboveOrBelow.Above ? 17 : -7),
PriceMarkerTextColor,
font,
TextAlignment.Left,
Brushes.Transparent,
Brushes.Transparent,
100).ZOrder = PriceMarkerZOrder == BackOrFront.Back ? -1 : ZOrder;
}
}

Comment