Microsoft.SqlServer.XEvent.XELite 2024.2.5.1

Prefix Reserved
dotnet add package Microsoft.SqlServer.XEvent.XELite --version 2024.2.5.1                
NuGet\Install-Package Microsoft.SqlServer.XEvent.XELite -Version 2024.2.5.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Microsoft.SqlServer.XEvent.XELite" Version="2024.2.5.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Microsoft.SqlServer.XEvent.XELite --version 2024.2.5.1                
#r "nuget: Microsoft.SqlServer.XEvent.XELite, 2024.2.5.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Microsoft.SqlServer.XEvent.XELite as a Cake Addin
#addin nuget:?package=Microsoft.SqlServer.XEvent.XELite&version=2024.2.5.1

// Install Microsoft.SqlServer.XEvent.XELite as a Cake Tool
#tool nuget:?package=Microsoft.SqlServer.XEvent.XELite&version=2024.2.5.1                

Introduction

XELite is cross platform library to read XEvents from XEL files or live SQL streams.

Getting Started

Using XELite to parse XEL files

static void OutputXELFile(string fileName)
{
    var xeStream = new XEFileEventStreamer(fileName);

    xeStream.ReadEventStream(
        () => {
            Console.WriteLine("Headers found");
            return Task.CompletedTask;
        },
        xevent => {
            Console.WriteLine(xevent);
            Console.WriteLine("");
            return Task.CompletedTask;
        },
        CancellationToken.None).Wait();
}

Using XELite to connect to live event session

Step 1: Create & start event session. For example:

CREATE EVENT SESSION [sample_session] ON SERVER 
ADD EVENT sqlserver.sql_statement_completed(
    ACTION(sqlserver.sql_text))
GO

ALTER EVENT SESSION [sample_session] ON SERVER 
    STATE = START
GO

Step 2: Implement the code to connect and read the events. Here is a sample:

static void OutputXELStream(string connectionString, string sessionName)
{
    var cancellationTokenSource = new CancellationTokenSource();

    var xeStream = new XELiveEventStreamer(connectionString, sessionName);

    Console.WriteLine("Press any key to stop listening...");
    Task waitTask = Task.Run(() =>
        {
            Console.ReadKey();
            cancellationTokenSource.Cancel();
        });

    Task readTask = xeStream.ReadEventStream(() =>
        {
            Console.WriteLine("Connected to session");
            return Task.CompletedTask;
        },
        xevent =>
        {
            Console.WriteLine(xevent);
            Console.WriteLine("");
            return Task.CompletedTask;
        },
        cancellationTokenSource.Token);


    try
    {
        Task.WaitAny(waitTask, readTask);
    }
    catch (TaskCanceledException)
    {
    }

    if (readTask.IsFaulted)
    {
        Console.Error.WriteLine("Failed with: {0}", readTask.Exception);
    }
}
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on Microsoft.SqlServer.XEvent.XELite:

Package Downloads
YY.DBTools.SQLServer.XEvents

Library for reading Extended Events of SQL Server

SabinIO.SqlTest

Library for the undertaking of testing against SQL Server

SabinIO.xEvent.Lib

Library for the processing of xEvent files

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on Microsoft.SqlServer.XEvent.XELite:

Repository Stars
microsoft/sqltoolsservice
SQL Tools API service that provides SQL Server data management capabilities.
Version Downloads Last updated
2024.2.5.1 18,242 2/7/2024
2023.1.30.3 12,613 2/1/2023
2022.11.10.6 3,136 11/12/2022
2021.12.12.2 6,290 2/13/2022
2021.6.21.10 436,508 8/12/2021
2021.1.14.8 12,937 1/14/2021
2020.11.19.1 873 11/19/2020
2020.7.27.1 5,282 7/27/2020
2020.7.8.1 588 7/8/2020
2019.11.20.2 43,763 11/25/2019
2019.7.2.9 3,716 7/2/2019
2019.6.5.2 739 6/5/2019
2019.5.24.2 833 5/24/2019

Update dependency