DynamoVisualProgramming.DynamoServices by Autodesk

<PackageReference Include="DynamoVisualProgramming.DynamoServices" Version="1.0.0-beta3" />

 TraceUtils

public static class TraceUtils
Utility class to Get/Set TraceData
using System; using System.Runtime.Serialization; using System.Threading; namespace DynamoServices { public static class TraceUtils { public static ISerializable GetTraceData(string key) { object data = Thread.GetData(Thread.GetNamedDataSlot(key)); if (data == null) return null; ISerializable serializable = data as ISerializable; if (serializable != null) return serializable; throw new InvalidOperationException("Data in Named slot was not serializable"); } public static void SetTraceData(string key, ISerializable value) { Thread.SetData(Thread.GetNamedDataSlot(key), value); } } }