DynamoVisualProgramming.DynamoServices by Autodesk

<PackageReference Include="DynamoVisualProgramming.DynamoServices" Version="2.18.0-beta3734" />

 TraceUtils

public static class TraceUtils
Utility class to Get/Set TraceData
using System; using System.Collections.Generic; using System.Runtime.Serialization; namespace DynamoServices { public static class TraceUtils { internal const string __TEMP_REVIT_TRACE_ID = "{0459D869-0C72-447F-96D8-08A7FB92214B}-REVIT"; [ThreadStatic] private static Dictionary<string, ISerializable> _localStorageSlot; internal static Dictionary<string, ISerializable> LocalStorageSlot { get { return _localStorageSlot ?? (_localStorageSlot = new Dictionary<string, ISerializable>()); } set { _localStorageSlot = value; } } internal static List<string> TEMP_GetTraceKeys() { return new List<string> { "{0459D869-0C72-447F-96D8-08A7FB92214B}-REVIT" }; } internal static void ClearTLSKey(string key) { LocalStorageSlot.Remove(key); } internal static void ClearAllKnownTLSKeys() { LocalStorageSlot.Clear(); } public static ISerializable GetTraceData(string key) { if (!LocalStorageSlot.TryGetValue(key, out ISerializable value)) return null; return value; } public static void SetTraceData(string key, ISerializable value) { if (LocalStorageSlot.ContainsKey(key)) LocalStorageSlot[key] = value; else LocalStorageSlot.Add(key, value); } } }