diff --git a/RetailCoder.VBE/App.cs b/RetailCoder.VBE/App.cs index a8c1e21e84..d470528c9c 100644 --- a/RetailCoder.VBE/App.cs +++ b/RetailCoder.VBE/App.cs @@ -19,12 +19,12 @@ public class App : IDisposable { private readonly VBE _vbe; private readonly AddIn _addIn; - private readonly IList _inspections; - private readonly Inspector _inspector; - private readonly ParserErrorsPresenter _parserErrorsPresenter; + private IList _inspections; + private Inspector _inspector; + private ParserErrorsPresenter _parserErrorsPresenter; private readonly IGeneralConfigService _configService = new ConfigurationLoader(); private readonly ActiveCodePaneEditor _editor; - private readonly IRubberduckParser _parser; + private IRubberduckParser _parser; private Configuration _config; private RubberduckMenu _menu; @@ -35,18 +35,12 @@ public App(VBE vbe, AddIn addIn) { _vbe = vbe; _addIn = addIn; - _inspections = _configService.GetImplementedCodeInspections(); - _parser = new RubberduckParser(); _parserErrorsPresenter = new ParserErrorsPresenter(vbe, addIn); - _parser.ParseStarted += _parser_ParseStarted; - _parser.ParserError += _parser_ParserError; _configService.SettingsChanged += _configService_SettingsChanged; _editor = new ActiveCodePaneEditor(vbe); - _inspector = new Inspector(_parser, _inspections); - LoadConfig(); } @@ -71,8 +65,6 @@ private void LoadConfig() _configService.SaveConfiguration(_config); } - EnableCodeInspections(_config); - if (_menu != null) { _menu.Dispose(); @@ -92,6 +84,31 @@ private void LoadConfig() _codeInspectionsToolbar.Dispose(); } + if (_inspector != null) + { + _inspector.Dispose(); + } + + if (_parserErrorsPresenter != null) + { + _parserErrorsPresenter.Dispose(); + } + + if (_parser != null) + { + _parser.ParseStarted -= _parser_ParseStarted; + _parser.ParserError -= _parser_ParserError; + } + _parser = new RubberduckParser(); + _parser.ParseStarted += _parser_ParseStarted; + _parser.ParserError += _parser_ParserError; + + _inspections = _configService.GetImplementedCodeInspections(); + _inspector = new Inspector(_parser, _inspections); + EnableCodeInspections(_config); + + _parserErrorsPresenter = new ParserErrorsPresenter(_vbe, _addIn); + _menu = new RubberduckMenu(_vbe, _addIn, _configService, _parser, _editor, _inspector); _menu.Initialize(); diff --git a/RetailCoder.VBE/Rubberduck.csproj b/RetailCoder.VBE/Rubberduck.csproj index f3ba570568..6027a7db77 100644 --- a/RetailCoder.VBE/Rubberduck.csproj +++ b/RetailCoder.VBE/Rubberduck.csproj @@ -1073,10 +1073,12 @@ - c:\Windows\Microsoft.NET\Framework64\v4.0.30319\regasm.exe "$(TargetPath)" /codebase /tlb + + - c:\Windows\Microsoft.NET\Framework64\v4.0.30319\regasm.exe "$(TargetPath)" /u + +