There's a Bug with Extended Events creation in SQL Server Management Studio 18.7: what it is and a workaround

■
Table of Contents

UPDATE 2: The bug was fixed in SSMS 18.8
UPDATE: The bug still isn’t fixed in SSMS 18.7.1

Oh boy, what I found; I haven’t seen anybody else reporting on it, yet, so here I am.
Fortunately, the bug is not breaking, as I’ve found a workaround, but still.

Repro

  1. Open the “New Session…” GUI for extended events in SSMS
  2. Give it a name, it’s not important
  3. Add an event with a Duration Field, I’ve added sp_statement_completed and configure it to be higher than an arbitrary value

SSMS 18.7 New Session dialog: sp_statement_completed event with the filter duration > 10000000

If you now try to press OK to create the Session, it will error out like this:

SSMS error creating the session: duration value for sp_statement_completed is invalid, Microsoft SQL Server Error 25713

Explaination and Workaround

By scripting out the code that the GUI is trying to generate the issue is clear:

Scripted CREATE EVENT SESSION from the dialog: SSMS wraps the duration filter in quotes, ‘10000000’, instead of an integer

For some reason, it’s putting quotes around the date value, hence the query execution fails because the duration field expects an integer value.

The fix is easy, just remove the quotes yourself and execute the scripted query:

Workaround: the same CREATE EVENT SESSION with the quotes removed, duration > 10000000, completes successfully

I hope it helps, and especially that it gets fixed asap alongside other bugs that are definitely there.

Related Articles