@@ -239,10 +239,7 @@ private void ExecuteCommonParseActivities(IReadOnlyCollection<QualifiedModuleNam
239239            _parserStateManager . SetStatusAndFireStateChanged ( this ,  ParserState . LoadingReference ,  token ) ; 
240240            token . ThrowIfCancellationRequested ( ) ; 
241241
242-             RefreshUserComProjects ( toParse ,  newProjectIds ) ; 
243-             token . ThrowIfCancellationRequested ( ) ; 
244- 
245-             SyncDeclarationsFromUserComProjects ( toParse ,  token ,  toReresolveReferences ) ; 
242+             ProcessUserComProjects ( ref  token ,  ref  toParse ,  ref  toReresolveReferences ,  ref  newProjectIds ) ; 
246243
247244            SyncComReferences ( toParse ,  token ,  toReresolveReferences ) ; 
248245            token . ThrowIfCancellationRequested ( ) ; 
@@ -337,6 +334,17 @@ private void ExecuteCommonParseActivities(IReadOnlyCollection<QualifiedModuleNam
337334            token . ThrowIfCancellationRequested ( ) ; 
338335        } 
339336
337+         //TODO: Remove the conditional compilation after loading from typelibs actually works. 
338+         //TODO: Improve the handling to avoid host crashing. See https://github.com/rubberduck-vba/Rubberduck/issues/5217 
339+         [ Conditional ( "LOAD_USER_COM_PROJECTS" ) ] 
340+         private  void  ProcessUserComProjects ( ref  CancellationToken  token ,  ref  IReadOnlyCollection < QualifiedModuleName >  toParse ,  ref  HashSet < QualifiedModuleName >  toReresolveReferences ,  ref  IReadOnlyCollection < string >  newProjectIds ) 
341+         { 
342+             RefreshUserComProjects ( toParse ,  newProjectIds ) ; 
343+             token . ThrowIfCancellationRequested ( ) ; 
344+ 
345+             SyncDeclarationsFromUserComProjects ( toParse ,  token ,  toReresolveReferences ) ; 
346+         } 
347+ 
340348        private  void  SyncComReferences ( IReadOnlyCollection < QualifiedModuleName >  toParse ,  CancellationToken  token ,  HashSet < QualifiedModuleName >  toReresolveReferences ) 
341349        { 
342350            _parsingStageService . SyncComReferences ( token ) ; 
0 commit comments