Cannot open Extended Event when default database not master
You might get an error message when looking at Extended Event data (file, etc) if Object Explorer isn't connected to the master database.
Reproduced on SSMS 18.4 against:
Microsoft SQL Server 2016 (SP2-CU7-GDR) (KB4505222) - 13.0.5366.0 (X64) Jun 15 2019 08:22:25 Copyright (c) Microsoft Corporation Standard Edition (64-bit) on Windows Server 2012 R2 Standard 6.3 <X64> (Build 9600: ) (Hypervisor)
The workaround to disconnect and reconnect explicitly stating master as the database allowed me to read the extended events file.
Karl Fasick commented
Yes, even latest SSMS and SQL 2017 14.0.3030.27, can reproduce. I was reading Jess Borland's article http://blogs.lessthandot.com/index.php/datamgmt/dbprogramming/replacing-trace-flags-1204-and-1222-with-the-extended-events-system_health-session/ and hit this bug. Here's repro and fix: Note, it's not necessarily your login's default database that makes the difference - the hint is to the fix is in the description of this post - "Object Explorer isn't connected to the master database." To fix - disconnect Object Explorer - Reconnect, but go to Connection Properties and explicitly choose master to fix, or another to reproduce problem. Now drill into Management / Extended Events / Sessions / system_health / right click on package0.event_file - choose View Target Data. Either get the events or this error: TITLE: Microsoft SQL Server Management Studio
The storage failed to initialize using the provided parameters. (Microsoft.SqlServer.XEventStorage)
Cannot view the function 'fn_MSXe_read_event_stream', because it does not exist or you do not have permission. (Microsoft SQL Server, Error: 15151)