38

When i try to access my solution Properties, i get the following error:

Object reference not set to an instance of an object

I am using VS 2012. What could be the cause of this?

enter image description here

enter image description here

ViRuSTriNiTy
  • 5,017
  • 2
  • 32
  • 58
Kenci
  • 4,794
  • 15
  • 64
  • 108
  • 1
    Try Visual Studio Safe Mode http://msdn.microsoft.com/en-us/library/ms241278(v=vs.110).aspx if it works better, it's caused by an addin or a VS package. – Simon Mourier Dec 07 '12 at 16:11

5 Answers5

40

Some extensions may cause this. Try disabling extensions and restarting Visual Studio.

Quite often error will be gone even if you re-enable extensions after this.

There's a bug report on Microsoft Connect (link). It is marked there as "Closed as External", but it seems that it may occur randomly with any extension, so would be worth voting it there to bring it to Microsofts attention.

Jarek Kardas
  • 8,445
  • 1
  • 31
  • 32
  • 3
    Installing it again and the issue is still there – Kenci Dec 13 '12 at 10:06
  • Uninstalling NuGet worked for me, and after reinstalling it I can still access properties. Disabling other extensions like ReSharper and Web Essentials didn't do anything. – Kurt Schindler Apr 16 '13 at 13:26
  • 4
    Uninstalled `NuGet Package Manager` and it worked but installed it again and the problem persists. – Leniel Maccaferri Jul 13 '13 at 00:39
  • Updating to the latest version of NuGet Package Manager (2.6.40627) fixed the issue for me. – Ben Foster Aug 20 '13 at 09:18
  • In my case, it was VSCommand. After disabling it and enabling it again, everything works perfectly. – Samuel Mar 30 '15 at 15:19
  • 3
    Anyone want to edit this answer and post HOW to disable extensions and HOW to uninstall/re-install NuGet??? Terrible answer. Should never just say "do x" without instructions on how and just assume everyone knows. – vapcguy Oct 05 '17 at 21:30
11

In my case, the problem was solution-specific. NuGet was causing this error, but not the extension itself but a NuGet package that generated an error on VS load. When I opened NuGet Package Manager Console I saw a big red text with a description of the error. In my case it was T4Scaffolding.Core package, which in turn is a dependency of MVCMailer.

If this is your case, you will probably see what package generates an error in PM Console.

V.B.
  • 6,236
  • 1
  • 33
  • 56
  • This was also my issue - I uninstalled T4Scaffolding.Core, saved, closed solution/Visual Studio, and re-opened the solution. – Cody Nov 12 '14 at 19:28
3

I faced this dialog too and i'm not sure what exactly causes this as i couldn't even open the NuGet console to see detailed error messages.

Closing Visual Studio, deleting %AppData%\Microsoft\VisualStudio and restarting Visual Studio worked for me as it causes a reset of various things like window configurations.

I think if this dialog is displayed some files may be corrupt in %AppData%\Microsoft\VisualStudio and by deleting that folder Visual Studio can start normally again.

Update:

The issue arises on my machine when i start Visual Studio by using "run as administator" whereas Visual Studio has been started before without that option and %AppData%\Microsoft\VisualStudio had been created without the administator association.

ViRuSTriNiTy
  • 5,017
  • 2
  • 32
  • 58
  • 1
    This solution didn't solve it for me.. but when i "Ran as Administrator" it solved my problem.. so I tried it because of your answer – hanzolo Jul 14 '15 at 22:17
  • Closed VS, deleted everything under `C:\Users\myname\%AppData%\Local\Microsoft\VisualStudio` and let it get re-created by re-running VS, no change. Ran VS as an Administrator, no change. This might be something that works for some, but it didn't work for me. – vapcguy Oct 05 '17 at 21:21
3

Visual Studio 2013: I had this issue when I tried opening TOOLS -> Extensions and Updates. I used @ViRuSTriNiTy idea, but only cleaned the files from: C:\Users[myUserName]\AppData\Local\Microsoft\VisualStudio\12.0\Extensions There are 2 cache files over there. Deleted them and restarted VS2013 and it was fixed

Alonzzo2
  • 959
  • 10
  • 24
0

The way it was happening for me might be unique to me/my setup, but I'd love to know if anyone else has this happen, and if they find out why:

  • If I launch an .sln file by double-clicking it, it will load VS and I can right-click the Solution and get Properties to come up no problem.
  • If I go to "Open Project" on the Visual Studio welcome page or from File > Open > Project/Solution, navigate to the .sln file and launch it by selecting it and clicking "Open" in the File dialog, that's when I have this issue.

I'm going to just always launch the .sln file from now on, but I'd love to know why this happens when using "Open Project" from the welcome page or from File > Open > Project/Solution! I tried going into Tools > NuGet Package Manager > General and I unchecked the options for allowing NuGet to download missing packages and Skip applying binding redirects, and under Package Sources I de-selected the checkboxes (my dev machine does not connect to the internet). Environment > Extensions and Updates: I tried it with and without "Load per user extensions when running as administrator" and running it as an Admin and without running as Admin. Also tried just deleting everything at C:\Users\me\AppData\Local\Microsoft\VisualStudio. No change from those 2 bullets above.

vapcguy
  • 7,097
  • 1
  • 56
  • 52