Friday, March 21, 2014

Visual Studio 2012 error + An exception has encountered .This may be caused by an extension



This  error came up in our server ,by which I was not able to open the ascx or aspx files in visual studio 2012.This error caused the intellisense to not work in design pages, also the Tools box was not showing up with any controls only the HTML controls was available.

Analysing the Log I found that there was the below exception


System.NullReferenceException:Object referencenot set to instance of an object.at Microsoft.VisualStudio.Web.Exports.HTMLClassifierProvider.Microsoft.VisualStudio.Text.Classification.
IClassificationProvider.GetClassifier(ITextBuffer textBuffer) at Microsoft.VisualStudio.Text.Classification.Implemention.ClassifierTaggerProvider

Logs can be found at  "C:\User\UserName\AppData\Roaming\Microsoft\VisualStudio\11.0\ActivityLog.xml"

You can try below steps to resolve this issue

  1. Open visual studio click Tools  then Import and Export setting  reset all.This will reset all your custom changes
  2. Choose Tool -->Tools Box item run it once
  3. Tools-->Extension and updates-->If you have installed any vulnarebale packages uninstall them
  4. Run the Visual Studio Repair
  5. Uninstall and Install the VS 2012 again
  6. In my case none of the above worked
So what I did was to give a try to reinstall the .netFrameWork 4.5 .This did the magic for me.
I guess some of the system update corrupted the framework hence the issue was caused.VS2012 installer also installs the framework but since it was already installed, it dint try to install again I believe. Downloading a new package of .net FrameWork 4.5 and installing it solved my issue with Visual Studio 2012