Visual Studio Crashing because Temp Folder issue

Today I was getting an error when running Visual Studio.

<time>2018/02/06 14:46:47.096</time>
<source>Editor or Editor Extension</source>
<description>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 System.Windows.Input.Cursor.LoadFromStream(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.&lt;AddMargins&gt;b__2(IWpfTextViewMarginProvider mp) at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.InstantiateExtension[TExtension,TMetadata,TExtensionInstance](Object errorSource, Lazy`2 provider, Func`2 getter)</description>

So I internet searched and found several articles that suggested my “Temp” folder(s) were full.

No problem, right click C:, properties and do some clean up and delete Temp items.

I still was getting the error.

The issue was that while cleaning up “Temp” gets rid of files, it does not seem to get rid of subfolders.  And subfolders (with no files) still take up space.

So I found this StackOverFlow article:

I put this code in a .bat file


del /q “C:\Users\MYUSERNAME\AppData\Local\Temp\*”
FOR /D %%p IN (“C:\Users\MYUSERNAME\AppData\Local\Temp\*.*”) DO rmdir “%%p” /s /q


Now my Visual Studio starts normally.  Apparently, I had a BUNCH of (empty) subfolders in my temp path.



This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s