Randomly when writing SQL queries in SSMS 2014, I'll get a popup that "Visual Studio has encountered an exception. This may be caused by an extension" along with a tip that I can run the application with the /log parameter and check the ActivityLog.xml file created somewhere in my user's AppData directory.
After this popup, IntelliSense stops updating, and toggling it on/off has no effect (any errors still underlined with red squiggly lines, etc, including their mouse hover popups remain indefinitely). Note that this happens even without any errors in my script.
But that's not really the issue, as I get the "Value does not fall within the expected range" error EVERY TIME I PUSH THE BACKSPACE KEY, although the Delete key works just fine.
This issue was not present until many months after I started using the application.
The workaround so far has been to copy the query into a new query window (immediately works), or to wait for it to randomly stop. So the issue is isolated to the query window.
Steps to reproduce:
- Type SQL code for a while.
There seems to be absolutely no commonality, since it has happened with all combinations of syntactically correct/incorrect statements, and long/short queries (ranging from a single SELECT statement to a multi-thousand line stored procedure). It also happens in statements not referencing any user-defined entities (e.g. selecting from the system tables).
Troubleshooting steps taken:
- Making sure all updates installed
- Restarting computer
- Disabling all extensions - I'm not using any... I followed this registry path and I have no AddIns key in either the x86 or x64 registry paths for any version number of SQL Server.
- Googling for issue - nothing relevant - I'm typing queries and not using SSIS
- Running SSMS with /log parameter - initial error telling me to start SSMS with the /log parameter is not logged. But the "out of range" error is logged with this identical stack trace every time (included at bottom of post)
Looking at the log file, they may a two hour gap between the last message (larger time than I have been in the query window) and the exception caused by using the backspace key.
The following steps were performed by my company's IT department:
- Clearing IntelliSense and other caches
- Reinstalling SSMS
And later:
- Entire computer replaced (I have since completely abandoned IntelliSense for SQL). It worked for a while, then started again after a couple months.
I seem to be the only one with this issue, as my company's IT department has not seen it before, and all Googling for this error message has been fruitless (I'm not using SSIS). It's been bugging me for over a month now and driving me crazy.
Thank you.
Update I am getting similar screwy behavior in Visual Studio 2013 when editing JavaScript, and it even threw an error which I think is the same as the first one thrown in SSMS before the backspace issue (but I clicked too fast and closed it before reading).
Sample Stack Trace in ActivityLog.xml
<entry>
<record>1172</record>
<time>2017/01/16 19:33:02.289</time>
<type>Error</type>
<source>Editor or Editor Extension</source>
<description>
System.ArgumentException: Value does not fall within the expected range.

at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)

at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode)

at Microsoft.VisualStudio.NativeMethods.ThrowOnFailure(Int32 hr, Int32[] expectedHRFailure)

at RadLangSvc.SqlCompletionSet.GetTextTypedSoFar()

at RadLangSvc.Source.OnCommand(IVsTextView textView, VSStd2KCmdID command, Char ch)

at Microsoft.VisualStudio.Package.ViewFilter.HandlePostExec(Guid& guidCmdGroup, UInt32 nCmdId, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut, Boolean bufferWasChanged)

at Microsoft.VisualStudio.Package.ViewFilter.ExecCommand(Guid& guidCmdGroup, UInt32 nCmdId, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)

at Microsoft.VisualStudio.Package.ViewFilter.Microsoft.VisualStudio.OLE.Interop.IOleCommandTarget.Exec(Guid& guidCmdGroup, UInt32 nCmdId, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)

at Microsoft.VisualStudio.Editor.Implementation.CommandChainNode.Exec(Guid& pguidCmdGroup, UInt32 nCmdID, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)

at Microsoft.VisualStudio.Editor.Implementation.CommandFilterWrapper.Exec(Guid& pguidCmdGroup, UInt32 nCmdID, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)

at Microsoft.VisualStudio.Editor.Implementation.CommandChainNode.Exec(Guid& pguidCmdGroup, UInt32 nCmdID, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)

at Microsoft.VisualStudio.Editor.Implementation.CommandFilterWrapper.Exec(Guid& pguidCmdGroup, UInt32 nCmdID, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)

at Microsoft.VisualStudio.Editor.Implementation.CommandChainNode.Exec(Guid& pguidCmdGroup, UInt32 nCmdID, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)

at Microsoft.VisualStudio.Editor.Implementation.CommandFilterWrapper.Exec(Guid& pguidCmdGroup, UInt32 nCmdID, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)

at Microsoft.VisualStudio.Editor.Implementation.VsTextViewAdapter.Exec(Guid& pguidCmdGroup, UInt32 nCmdID, UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)

at Microsoft.VisualStudio.Editor.Implementation.VsKeyboardFilter.SendCommand(Guid cmdGroup, UInt32 cmdID, Object inParam)

at Microsoft.VisualStudio.Editor.Implementation.VsKeyboardFilter.TextInput(TextCompositionEventArgs args)

at Microsoft.VisualStudio.Text.Editor.Implementation.KeyProcessorDispatcher.<DispatchTextInputEvents>b__0(KeyProcessor p, TextCompositionEventArgs args)

at Microsoft.VisualStudio.Text.Editor.Implementation.KeyProcessorDispatcher.<>c__DisplayClass1e`1.<Dispatch>b__1a()

at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.CallExtensionPoint(Object errorSource, Action call)
</description>
</entry>
2019 update We upgraded to VS 2017 and SQL IntelliSense is behaving there like it did before. It just went full retard and spammed memory and CPU forcing me to use Task Manager to kill VS.
Version information:
Microsoft SQL Server Management Studio 12.0.4232.0
Microsoft Analysis Services Client Tools 12.0.4232.0
Microsoft Data Access Components (MDAC) 6.1.7601.17514
Microsoft MSXML 3.0 5.0 6.0
Microsoft Internet Explorer 9.11.9600.18537
Microsoft .NET Framework 4.0.30319.36373
Operating System 6.1.7601