Microsoft.SqlServer.XEvent.XELite 2021.12.12.2 The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved

.NET 5.0 .NET Standard 2.0 .NET Framework 4.6.2
Install-Package Microsoft.SqlServer.XEvent.XELite -Version 2021.12.12.2
dotnet add package Microsoft.SqlServer.XEvent.XELite --version 2021.12.12.2
<PackageReference Include="Microsoft.SqlServer.XEvent.XELite" Version="2021.12.12.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Microsoft.SqlServer.XEvent.XELite --version 2021.12.12.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Microsoft.SqlServer.XEvent.XELite, 2021.12.12.2"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. 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=2021.12.12.2

// Install Microsoft.SqlServer.XEvent.XELite as a Cake Tool
#tool nuget:?package=Microsoft.SqlServer.XEvent.XELite&version=2021.12.12.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

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 Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net461 net462 net463 net47 net471 net472 net48
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
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

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2021.12.12.2 1,351 2/13/2022
2021.6.21.10 94,881 8/12/2021
2021.1.14.8 6,933 1/14/2021
2020.11.19.1 572 11/19/2020
2020.7.27.1 1,860 7/27/2020
2020.7.8.1 352 7/8/2020
2019.11.20.2 5,758 11/25/2019
2019.7.2.9 3,190 7/2/2019
2019.6.5.2 536 6/5/2019
2019.5.24.2 629 5/24/2019

Update Microsoft.Data.SqlClient dependency