51

I was using ReSharper with visual studio 2015 and my pc got really slow because of ReSharper and i had to uninstall it. After uninstallation completed when i opened up my project the only thing i saw was a blank screen like this.like this

I know that uninstalling ReSharper caused it and i looked and tried to fix it by changing Text Editor options but nothing worked so far. I've also searched about this issue and nothing came across yet.

Thanks

Arefi Clayton
  • 841
  • 2
  • 10
  • 19
  • @GrantWinney I can see the code in .cs files when i open them with notepad or with a different text editor. Also, i just tried to create a new Console Application project and i can't see my code there either. – Arefi Clayton May 14 '15 at 14:09
  • Maybe you could go to the Windows Restore Point that was created immediately before you installed ReSharper? Note that this will uninstall any applications that have been added since you installed ReSharper. – ChicagoMike May 14 '15 at 14:10
  • @ChicagoMike that would be a little dangerous since it's been almost a month now. – Arefi Clayton May 14 '15 at 14:11
  • Arefi, it only gets rid of programs that have been installed, not data or documents that you've built. I've done it several times. – ChicagoMike May 14 '15 at 17:37
  • I have the same problem. I never installed ReSharper though, I had this right from the beginning. For me, it happens if I close a solution with documents open, then re-open the solution by double clicking on the .sln file. If documents weren't open when I closed it everything works file. If I open VS first, then load the solution everything works fine. It seems to be a VS initialization bug. – Josh Jul 23 '15 at 21:23

10 Answers10

132

This error is caused by a corrupted Visual Studio cache.

Close all running Visual Studio tasks, then delete all files in the folders ComponentModelCache and MEFCacheBackup located in:

%LocalAppData%\Microsoft\VisualStudio\<YOUR_VISUAL_STUDIO_VERSION>
Silverstorm
  • 15,398
  • 2
  • 38
  • 52
  • 8
    Thanks! It's sad that Visual stupido has gotten to the point that one little tiny thing is out of whack, and you'll spend hours googling to find the needle in the haystack... I call it the "Microsoft Way".. All devs know it. – ttomsen Mar 28 '17 at 13:19
  • 2
    Worked for me in C++. `ComponentModelCache` was empty but `MEFCacheBackup` had files. Deleting them solved the problem. Thanks. – Alan Apr 19 '17 at 03:14
  • 3
    Worked for me as well. we should be able to force this as the correct answer. – greektreat Jul 14 '17 at 15:03
  • Had the same problem with VS 2017. Clearing the cached fixed the problem. Thanks. – Lydon Oct 23 '17 at 23:23
  • Problem Solved with my VS2015. Best regards from Toulouse\France – sstassin Jan 11 '18 at 10:26
  • Thank you, this solved my issue, I never had to restart my computer! – superachu Feb 28 '18 at 15:02
  • Fixed my problem too, was driving me nuts as I couldn't fathom what had gone wrong. Thought it was a Windows update that had broken things. – Kris Wragg May 23 '18 at 10:17
  • Your answer worked for me. Visual Studio 2019 was only showing me a blank page when using "View Code" or F7 when trying to edit form code. Thank you. – LoneSpawn Jun 04 '20 at 01:42
  • I had problem for VS2015, ComponentModelCache was there I deleted it. But MEFCacheBackup was not there. Still the problem solved. – Hemanth Jun 18 '20 at 14:17
  • One thing to note for me for VS2017: The ComponentModelCache & MEFCacheBackup was under the 15.0_11ae2621 directory. I think it was actually cleaning the MEFCacheBackup dir, that did the trick. – Robert Koernke Dec 14 '20 at 15:42
  • 1
    Didn't work for me. Also there was no `MEFCacheBackup`. An extension might be causing this, like the other answers mentioned. – Matt Kleinsmith Mar 16 '21 at 09:48
  • You can copy/paste *%appdata%\..\Local\Microsoft\VisualStudio* into Run, then just open the version folder if you want to be slightly lazy. I could temporarily solve the issue by just closing the window and re-opening it from Solution Explorer, but it's nicer now that I don't have to. – MichaelS Feb 22 '22 at 08:57
  • im having this issue in vs 2020 – Alex Gordon Aug 29 '22 at 02:01
20

I know this is a really old thread. I recently had this problem and found that it was a corrupt font.

In my case I was using Cascadia Code font. uninstalling and reinstalling that font fixed it for me.

Aaron Glover
  • 1,199
  • 2
  • 13
  • 30
  • 1
    This was my issue. I noticed first that Windows Terminal, which I've set to use Cascadia Code font, works but complains that it couldn't load the font. That was the hint. Reinstalled the font and now everything works again. – Dealdiane Oct 05 '21 at 22:12
  • 2
    Thanks, finally I solved.. There goes 1 hour for no reason :) – tozlu Oct 09 '21 at 12:13
14

This happened to me on VS2022 and it was caused by the Cascadia Mono font being corrupted (by Windows update?). Issue also broke VS Code. Explained on this thread.

Ben Collins
  • 455
  • 5
  • 7
  • 1
    This exact scenario caused my issue as well. As I had just done a Windows Update (Apply update and shutdown), a simple reboot seemed to do the trick for me… – ShortDevelopment Jun 08 '22 at 08:38
6

I am faced with the same issue in Visual Studio 2017 and 2019 after I installed the specific font Cascadia Code Microsoft provided for several months.

After I reverted the code font to common used font (such as Consolas), the code came back to show again.

Settings in Visual Studio:

Tools -> Options-> Environment -> Font and Colors

Bravo Yeung
  • 8,654
  • 5
  • 38
  • 45
1

In my case the reason, on a VS2013 install, was a temporary glitch in an extension called Productivity Power Tools 2013.

What I did was I disabled it from Tools -> Extensions and Updates. Then I restarted VS, enabled it again, restarted again and bish bash bosh, problem solved.

It's odd because I didn't have to hunt down cache folders to delete, but it did the trick.

s.m.
  • 7,895
  • 2
  • 38
  • 46
  • 1
    If I may ask @s.m. (and I know it was a long time ago) how did you track it down to that extension? I have a similar problem now in vs2019 (4.8.04084) - and would like to know where to start troubleshooting. I don't have "PPT 2013" installed. I have disabled all extensions in VS2019 and restarted VS, and the problem remains. When opening a previously unopened file from Solution Explorer it first appears blank, until I click on the title of another code window and click on the title of the intended one again. It's like a refresh issue. – Jonno May 19 '21 at 07:25
  • Hey there @Jonno. Damn, indeed this goes way back in software dev terms, as far as I recall I did not have this happen to me with newer releases. I can't even remember how I figured it out, most likely through trial and error. However, what you can try is to launch VS from the command line like this: `devenv.exe /log`. It should create an XML log whose name contains `ActivityLog` or some such wherever `%APPDATA%` resolves to (or maybe you can specify an output path right after `/log`). Hope that helps somehow, things like this are super annoying :/ – s.m. May 19 '21 at 07:33
  • thank you for your response, much appreciated. I can however provide feedback on the cause of _my_ issue _(for anyone out there reading through the comments)_ - it appears related to the fact that I have more than 1 display/screen/monitor and VS opens on my largest one which is *not* set as the default or _Main display_ (`Make this my main display` under Windows10 Display Settings). If I set the big screen to 'main display' the problem goes away. As annoying as it is, I LIVE with it now because I want my Taskbar on the laptop screen because I use a KVM to switch between machines. – Jonno Jul 09 '21 at 16:54
1

I had the same problem. Tried everything in this thread, and nothing worked.

In the end I solved it by launching Visual Studio Installer, and choosing More -> Repair (see screenshot). Keep in mind that it will reset some settings and will remove all manually installed extensions. That's is a small price to pay to fix the problem IMO.

Needless to say, that old versions of Visual Studio don't have the installer available.

N.B. If you have a fairly recent version of Visual Studio (I think starting from 2017 or so), you do have the installer, even if you're not aware of it. Just search your computer and you will find it.

Visual Studio Installer Interface

Michael Kruglos
  • 1,205
  • 14
  • 26
0

While I am sure the other answer is correct, I just restarted my VS 2017 in administrator mode, and it fixed the problem.

EatATaco
  • 687
  • 7
  • 25
0

In my case the, reason is the Productivity power tools 2013. I went to extension via Tools -> Extensions and Updates and after downloading and installing the extension, I restarted VS, that got it working again!

0

Restarting VS (2012, frozen tool set) fixed this in some cases. In others, WINDOW > Reset Window Layout.

Technophile
  • 464
  • 6
  • 9
0

I found the following worked:

  1. Right mouse-button click on the VB item for which the code is not being displayed (after noting in properties where it resides)
  2. Select "Exclude from Project"
  3. Right mouse-button click on the Solution/Project root node in the explorer
  4. Select "Add Existing Item" from the context menu that appears
  5. Navigate to that original file excluded in step 2 and select "Add" (or "Link" if it was previously linked in a folder external to your projects main files)
  6. Double left-mouse button click on the newly restored VB file

The code should now appear.

Chris Raisin
  • 384
  • 3
  • 7