VS2013: An exception has been encountered. This may be caused by an extension.

Hey peeps,

Ever gotten the nice error dialog when opening your Visual Studio saying something like: “An exception has been encountered. This may be caused by an extension. You can get more information by bexamining the file ~AppDataRoamingMicrosoftVisualStudio12.0ActivityLog.xml”?

Then after reading that, you think “OK, lets check it out. Might be some useful information there”.

Opening up the ActivityLog.xml you’ll probably notice that your assumption might have been slightly off base:

System.IO.IOException: The file exists. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.__Error.WinIOError() at System.IO.Path.InternalGetTempFileName(Boolean checkHost) at Microsoft.VisualStudio.Text.Utilities.WpfHelper.LoadCursorDPIAware(Stream cursorStream) at Microsoft.VisualStudio.Text.Editor.Implementation.LeftSelectionMargin.get_RightArrowCursor() at Microsoft.VisualStudio.Text.Editor.Implementation.LeftSelectionMarginProvider.CreateMargin(IWpfTextViewHost textViewHost, IWpfTextViewMargin containerMargin) at Microsoft.VisualStudio.Text.Utilities.ContainerMargin.<AddMargins>b__2(IWpfTextViewMarginProvider mp) at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.InstantiateExtension[TExtension,TMetadata,TExtensionInstance](Object errorSource, Lazy2 provider, Func2 getter)

Boom! Now what to do with that? Turns out this indicates that Visual Studio or some extension has difficulties creating files/folders in your Temp folder, because it is full! Full being it has over 65535 files/folders in it. Cleaning up the temp folder will do the trick, and also save you some space. In my case I had 4 GB of crap laying around. (Where did all that come from and why weren’t it deleted automatically?).

Oh, your Temp folder is probably located here: C:UsersYOURUSERNAMEAppDataLocalTemp.

Have fun!