Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

BETA7: System.Runtime.InteropServices.SEHException (0x80004005): External component h

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    BETA7: System.Runtime.InteropServices.SEHException (0x80004005): External component h

    This issue may be related to:


    Since the exception is different and this is now on BETA7, I started a new thread.

    I may have found a stress test to improve the SharpDX rendering. I have a tool that ran fine on NT7, but I have recently started to code it under NT8. One part puts us trade stats and it looks like it does this on each call to "OnMarketData()". It uses Draw.TextFixed(), for now I can probably slow down the refresh of this screen update, but the goal would be to get the SharpDX rendering to be stable.

    Here is the Exception:
    Code:
    Exception Caught: System.Runtime.InteropServices.SEHException (0x80004005): External component has thrown an exception.
       at SharpDX.Direct2D1.RenderTarget.CreateSolidColorBrush(Color4 color, Nullable`1 brushProperties, SolidColorBrush solidColorBrush)
       at NinjaTrader.Gui.DxExtensions.<>c__DisplayClass0_0.<ToDxBrush>b__0()
       at NinjaTrader.Gui.DxExtensions.ToDxBrush(Brush brush, RenderTarget renderTarget)
       at NinjaTrader.Gui.Stroke.set_RenderTarget(RenderTarget value)
       at NinjaTrader.NinjaScript.DrawingTools.Draw.TextFixedCore(NinjaScriptBase owner, String tag, String text, TextPosition textPosition, Brush textBrush, SimpleFont font, Brush outlineBrush, Brush areaBrush, Nullable`1 areaOpacity, Boolean isGlobal, String templateName, DashStyleHelper outlineDashStyle, Int32 outlineWidth)
       at NinjaTrader.NinjaScript.Strategies.LOM.LocalOrderManager.UpdateStatusBox()
       at NinjaTrader.NinjaScript.Strategies.LOM.LocalOrderManager.OnMarketData(MarketDataEventArgs e)
    The Offending line in the UpdateStatusBox() is:
    Code:
                    Draw.TextFixed(m_Strat,"PnL", m_Display, TextPosition.TopLeft,Brushes.Red, new SimpleFont("Arial", 8), Brushes.Black, Brushes.LightGray, 100);
    You should be able to generate a stress test around this code fragment. The m_Display value is multi-line with "\n" embedded.

    #2
    Hello,

    Thank you for the post.

    Could you provide more details on what type of stress test you are referring to? Do you mean to just put this line in a script and run the script until this occurs or was there more required for the test?

    If more is required than just the provided syntax, could you provide a sample script that demonstrates the test you are referring to as that would be best?


    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Hi Jess,

      This post is related to the other thread about SharpDX, I think Dave was working on that one and has most of the background.

      Looking at the stack trace, if you use the "Strategy Wizard" and add the OnMarketData() function. Place a Draw.TextFixed() statement like mine above and run the strategy on a think instrument, like the ES. This will stress the Rendering system. This will need to be placed on a chart of course rather than a strategy in the Control Panel.

      Comment


        #4
        We have this one isolated and reproduced on our side. The issue is with the fast changing of things like Brushes and that old brush instance being disposed in the middle of an OnRender() call of NinjaTrader.

        We are working on this for NT8 B8 with NTEIGHT-9163. I'll update you if I have progress for now to avoid this issue do not call OnRender() or change Brushes used in OnRender() from another thread. This will prevent the issue until we get a fix in.

        Comment


          #5
          Brett,

          Thanks, just to be clear, this issue is only related to calling the Draw.TextFixed() function, so you are looking at how this is affected by the base.OnRender() function? I don't use OnRender for this issue and only brushes are the Frozen built-in ones as you can see from the example "TextFixed" function.

          Comment


            #6
            Greg, you will probably find the final two comments on the following thread informative: http://ninjatrader.com/support/forum...ad.php?t=79888

            Comment


              #7
              This doesn't have to do with DrawText or even coding your own OnRender. This is about changing any Disposable render property such as any 'Brush' from another thread. As you can run into a race condition where your 'other' thread assigns a new brush to one of the properties being rendered such as something as simple as plot color and you would intermittently run into race condition where if was changed while chart is in middle of Render() call you would get exception.

              This is tracked in NTEIGHT-9163 where we've asked the developers to take a look and I would report back once done.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Kaledus, Today, 01:29 PM
              3 responses
              9 views
              0 likes
              Last Post NinjaTrader_Jesse  
              Started by frankthearm, Yesterday, 09:08 AM
              14 responses
              47 views
              0 likes
              Last Post NinjaTrader_Clayton  
              Started by gentlebenthebear, Today, 01:30 AM
              2 responses
              13 views
              0 likes
              Last Post gentlebenthebear  
              Started by PaulMohn, Today, 12:36 PM
              2 responses
              17 views
              0 likes
              Last Post PaulMohn  
              Started by Conceptzx, 10-11-2022, 06:38 AM
              2 responses
              56 views
              0 likes
              Last Post PhillT
              by PhillT
               
              Working...
              X