I have to close NinjaTrader with the Task Manager and when I reload NinjaTrader
I get an error message that NinjaTrade cannot recover the custom assembly.
I have attached the error message.
Context :
It does that only for an indicator that I converted from NT7.
It does it only on the second time I apply the indicator. Goes through well the first time.
I suspect it may come from the state.teminated.
Do you see something that could cause the problem from my code :
if (ChartWindow != null) { //Dispatcher used to Assure Executed on UI Thread this.Dispatcher.Invoke((Action)(() => { //Button Null Check if(NewsButton != null) { //Remove Button from Indicator's Chart ToolBar ChartWindow.MainMenu.Remove(NewsButton); //Remove Button Event Handler NewsButton.Click -= NewsButton_Click; //Set Button to Null - Not Needed - Done out of Habit NewsButton = null; } //Remove Tab Changed Event Handler ChartWindow.MainTabControl.SelectionChanged -= TabChangedHandler; //Set ChartWindow to Null - Not Needed - Again Just Done out of Habit //ChartWindow = null; })); //Dispatcher used to Assure Executed on UI Thread this.Dispatcher.Invoke((Action)(() => { //Button Null Check if(HelpButton != null) { //Remove Button from Indicator's Chart ToolBar ChartWindow.MainMenu.Remove(HelpButton); //Remove Button Event Handler HelpButton.Click -= HelpButton_Click; //Set Button to Null - Not Needed - Done out of Habit HelpButton = null; } //Remove Tab Changed Event Handler ChartWindow.MainTabControl.SelectionChanged -= TabChangedHandler; //Set ChartWindow to Null - Not Needed - Again Just Done out of Habit //ChartWindow = null; })); //Dispatcher used to Assure Executed on UI Thread this.Dispatcher.Invoke((Action)(() => { if( SkipRemoveUpdater == false ) { try { GlobalVariables8.ResetDictionariesForInstrument( this.Name+Instrument.MasterInstrument.Name+Instrument.Expiry+Bars.BarsType.DisplayName+BarsPeriod.Value ); GlobalVariables8.DisposeUpdater( this.Name+Instrument.MasterInstrument.Name+Instrument.Expiry+Bars.BarsType.DisplayName+BarsPeriod.Value ); } catch(Exception e) { Print(" An error occured : "+e.Message); } } GlobalVariables8.UnSubscribe("globalLandscapeDict",this); })); ChartWindow = null; }
Comment