HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

Intellisense automatically disabling with "WITH Inline = OFF"?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
withautomaticallyintellisenseinlinedisablingoff

Problem

In my SSMS (I'm using 18.10) project, I've been frustrated by the fact that Intellisense is not functioning in my files. I had conjectured that it was due to the size of the codebase, but in fact, I found somewhat far weirder.

In the following code:

CREATE FUNCTION X() RETURNS INT
WITH INLINE = OFF
AS
BEGIN
RETURN 1;
END;


If I remove WITH INLINE = OFF, Intellisense turns back on. What is going on?

Solution

What is going on?

A bug in the product. It looks like anything of the format

WITH foo = ON or WITH foo = OFF causes an unhandled exception during parsing.

Specifically an exception in

Microsoft.SqlServer.Management.SqlParser.dll!Microsoft.SqlServer.Management.SqlParser.SqlCodeDom.SqlFunctionDefinition.SqlFunctionDefinition(Microsoft.SqlServer.Management.SqlParser.SqlCodeDom.SqlObjectIdentifier name, System.Collections.Generic.List parameters, System.Collections.Generic.List options, Microsoft.SqlServer.Management.SqlParser.SqlCodeDom.SqlModuleOptionMask validOptions)

Due to it ending up with a null SqlModuleOption value in the options` collection

Probably not much that can be done about this except report it to the developers.

Context

StackExchange Database Administrators Q#305494, answer score: 5

Revisions (0)

No revisions yet.