roslyn: NavigateTo hangs the UI thread when searching in large solutions

Repro Steps: invoke Navigate To in Roslyn, and try to use it. Expected: a nice user experience. Actual: sadness where the UI gets blocked like crazy.

I attached a debugger to see why we were getting such bad hangs, and it turns out this is our fault. We build an index of DeclaredSymbolInfos and store that index as a way to quickly find members. We use that index, and produce a bunch of NavigateTo items. But once we are asked for the glyph or the display string of those items, we then try to realize a Symbol…on the UI thread. Curiously, since our index exists and is populated from syntax only, we are able to return items for projects we might not yet have Compilations for, so realizing symbols might be really expensive.

I chatted with @dpoeschl and @CyrusNajmabadi to discuss a few possible options:

  1. Make the Navigate To core system asynchronous. 😉
  2. Update our DeclaredSymbolInfo cache to cache additional information, ensuring we don’t need to realize symbols in the first place. This looked possible, but might require a bit of work because we produce the index from source only and might have to semi-reimplement SymbolDisplay.
  3. Don’t provide items through our provider until we have a symbol realized. This means there is a delay in giving the results (which makes our index less useful), but at least ensures we won’t hang the UI afterwards.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 15 (15 by maintainers)

Commits related to this issue

Most upvoted comments

Yeah, will do if I see it again.