Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Unhandled Exception - NT8 Crashing On Startup - Quick Fix!!

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

    Unhandled Exception - NT8 Crashing On Startup - Quick Fix!!

    Ran across this one recently and wanted to post about it so any poor soul going through this can recover their setup with minimal fuss.

    I was messing around with a new indicator trying to learn more about how DateTime worked. I did something stupid, and even though the .cs file compiled, upon refreshing NT8 crashed. Oops, I thought, I just have to comment out the offending statements and try something else. Nope! Upon relaunching NT8 promptly crashed again before everything loaded.

    Searching online, there were suggestions to use the Tools --> Remove Assembly option from the main menu, but I wasn't even getting that far. I was stumped. Until I started examining the file structure a bit more closely.

    In NT8 Desktop, under this path in windows are log files:

    C:\Users\Username\Documents\NinjaTrader 8\log

    These files end in .txt extension, so I loaded up Notepad++ and had a look. In my case, I was getting an error after the particular workspace where I had added the new indicator to a chart lived.

    2023-09-04 12:01:02:940|1|4|Restoring workspace 'DevWorkspace_090423'...
    2023-09-04 12:01:04:761|0|4|Unhandled exception: Object reference not set to an instance of an object.​
    Aha! So I examined the files in this directory:

    C:\Users\Username\Documents\NinjaTrader 8\workspaces

    These will be named the same as your workspaces you select in the main menu, ending in .xml -- Fired up Notepad++, and searched for any instance of the indicator name that I had recently added which was causing the problem. This includes removing the ENTIRE xml block where it is mentioned. Just look at the structure and it will make sense, since in xml each tag has a start/end pair.

    After saving the edited file, I launched NT8 and everything loaded fine, all my settings and indicators were present.

    Support may offer a fix of deleting the NinjaTrader.Custom.dll from the C:\Users\Username\Documents\NinjaTrader 8\bin\Custom directory (It gets recreated every time you start up) but in my case that meant that I didn't have any indicators on my charts, so I didn't want to have to re-do everything.

    Also note that simply deleting the offending .cs file from the C:\Users\Username\Documents\NinjaTrader 8\bin\Custom\Indicators directory didn't help, since the compile had already made other bits that NT8 was referencing.

    Hope that helps someone, its a lot less destructive than the other suggestions I've seen while searching.

    Cheers!

    #2
    Excellent deductive skills!
    The logs and trace folders have a wealth of information.

    My standard procedure is to experiment with new stuff
    in a new (or copy) of a workspace.

    Why?
    Because of this: If I have problems (like what you found) I edit
    the file '_Workspaces.xml' to remove the now offending workspace
    name from ActiveWorkspace and OpenWorkspaces.

    That removes the problem you had and then lets me delete
    the experimental workspace, and then I fix the code & recompile
    or remove the indicator/assembly, etc, to further eliminate the issue.

    Also, removing _Workspaces.xml is also an option (more a nuclear
    option) since NT will always recreate that file if it is missing.

    It seems like you had a nice discovery.

    More so than other platforms, I think NT can be a bit of a developer's
    paradise -- the logs and ability to self edit the many xml files, these
    are very helpful things to those users able to take advantage of them.

    [HINT: Config.xml has tons of cool things to discover.]

    Just my 2˘.

    Last edited by bltdavid; 09-05-2023, 03:19 PM. Reason: typo

    Comment


      #3
      Nice tip, I'll keep that in mind.

      Just happy that I was able to recover without having to go and re-do a lot of stuff.

      Cheers!

      Comment


        #4
        Thanks folks! I just bookmarked this post

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by samish18, Today, 04:52 PM
        0 responses
        10 views
        0 likes
        Last Post samish18  
        Started by sandman, Today, 04:19 PM
        0 responses
        12 views
        0 likes
        Last Post sandman
        by sandman
         
        Started by halgo_boulder, Today, 03:53 PM
        0 responses
        8 views
        0 likes
        Last Post halgo_boulder  
        Started by maggo123, Today, 08:25 AM
        4 responses
        138 views
        1 like
        Last Post NinjaTrader_Dennis  
        Started by NISNOS69, Today, 03:16 PM
        0 responses
        9 views
        1 like
        Last Post NISNOS69  
        Working...
        X