project-system icon indicating copy to clipboard operation
project-system copied to clipboard

C# IntelliSense Randomly Stops Working

Open ccicchitelli opened this issue 8 years ago • 9 comments

Hello All - I've recently moved to VS 2017. I also happen to be doing a major refactoring on a 50k line code base - namely restructuring namespaces/classes/file names. Anyways, it's been a pain because IntelliSense will constantly stop working at random times. Only a restart of VS will fix it. The files it "breaks" on works normally after a restart of VS. Opening the same solution file and making the same changes in VS 2015 does not result in the same behavior, so this appears to be a regression. I'm happy to test or provide logs as needed.

Note I've deleted all the SUO files as an attempted fix, it had no effect.

ETA: Adding a new file to the project seems to be a common trigger for this behavior, but it doesn't happen every time a new file is added, only some (most?) times.

ETA 2: I just saw a behavior where adding the first file breaks IntelliSense, but adding a second file restores it without a restart.

ccicchitelli avatar Dec 26 '17 21:12 ccicchitelli

What project types are you using? One way to determine this is do you have a References or Dependencies node in the project tree? References == native/legacy project system, Dependencies == new/managed project system. This will help us narrow down the cause.

davkean avatar Dec 26 '17 23:12 davkean

I do have a References node. This project was started back in 2011/2012 and upgraded since.

(It currently only targets the full .NET Framework, but a plan as part of this refactoring is to make it compatible with .NET Standard 2.0.)

ccicchitelli avatar Dec 27 '17 00:12 ccicchitelli

Can you check if you're on 15.5.1 or later in help about and see if this still repros for you? If you were editing project files outside of VS, there as an issue where "reloading" projects would sometimes incorrectly decide that the cached results in the SUO file was up to date when it wasn't after the project file changed.

For the files where it doesn't work if you open them, do they show as being in the "Miscellaneous files" project in the dropdown at the top left of the project?

Pilchie avatar Jan 03 '18 18:01 Pilchie

I'm actually on 15.5.2...

I was going to post an update today independent of your message, because after a few days of editing code without creating new files, I did a refactoring that split a large class (3k+ lines) into multiple files again. And after a few days of the issue not repeating, it came back as soon as I did...

So right now considering I already thought there was a correlation between this issue and creating new class files before this reaffirmation, I'm willing to suggest scoping this potential bug to when new files are created, and not simply when say a large class is edited without new files being created.

I'm happy to try to debug this and get you more data, I may need a few pointers on how though...

-Chris

P.S. I personally wonder if moving class methods into a new files, and forcing intellisense to keep the same method reference but with a different pointer to the new file, isn't the root of this. But this hunch is purely from live bug observations and not actually debugging...

ccicchitelli avatar Jan 04 '18 04:01 ccicchitelli

How did you create the new file and add it to the project?

Pilchie avatar Jan 04 '18 16:01 Pilchie

Always with the Add > Class context menu (maybe occasionally via Add > New Item), accessed from the Solution Explorer.

ccicchitelli avatar Jan 04 '18 17:01 ccicchitelli

Strange - that should definitely not cause an issue here.

Next time it happens can you look at the dropdown at the top left of the newly added class and see if it correctly identifies the project that the file was added to?

Pilchie avatar Jan 04 '18 17:01 Pilchie

Will do!

ccicchitelli avatar Jan 04 '18 18:01 ccicchitelli

Haven't heard anything here since Jan, so closing

Pilchie avatar May 09 '18 21:05 Pilchie