Skip to Content
TUtilityAPI reference and troubleshooting

API reference and troubleshooting

On this page

Core types

TypePackage / namespaceTopic
MemoryCache / MemoryCache<TKey,TValue>Core · TUtility.CachingCaches
ObjectPool<T> / UltraMpscQueue<T>Core · TUtilityPools and queues
AsyncConcurrencyLimiter / WaitLock / AsyncAutoResetEventCore · TUtilityAsync coordination
TimerX / TimerScheduler / CronCore · TUtilityScheduling
IScheduledTask / CronScheduledTaskCore · TUtilityScheduled work
CrcHelper / YitIdHelperCore · TUtilityData
BitHelper / ConvertHelperCore · TUtility.BitExtension / TUtility.ExtensionBits and conversion
SystemTextJsonServiceCore · TUtility.Json.ExtensionJSON
PagedList<T> / BasePageInputCore · TUtilityPaging
ImportPreviewOutput<T> / ImportPreviewListOutput<T>Core · TUtilityImport preview
OperResult / OperResult<T>TUtility · TUtilityResults
XTrace / TextFileLogTUtility · TUtility.LogLogging
AppStartup / App / AppDataPathsApp · TUtilityHosting

Ownership checklist

Dispose cache cleanup timers. Borrowed pool objects have one owner until return. Drain MPSC queues from one consumer. Release permits only after successful acquisition. Treat timer disposal and active-work completion separately. Let DI dispose its loggers.

Common parameters and return values

MemberResultParameters and constraints
MemoryCache<TKey,TValue>.Set(key, value, expire)boolInteger TTL uses seconds; negative values use the cache’s default Expire
TryGetValue(key, out value)boolUse the return value to distinguish a hit from a default-valued item
AsyncConcurrencyLimiter.WaitAsync()ValueTaskNo cancellation token; release in finally after successful acquisition
WaitLock.WaitAsync(cancellationToken)TaskCancellable wait; never release a permit you did not acquire
WaitLock.WaitAsync(millisecondsTimeout, cancellationToken)Task<bool>False on timeout; only true owns a permit
ImportPreviewOutputBase.ResultsSynchronizedList<ImportPreviewResult>Adding a failure does not update HasError or DataCount
OperResult.IsSuccessboolNull or zero OperCode means success, including a default struct

Import preview example · Async coordination example

Troubleshooting

Core does not contain OperResult. Install TUtility and import TUtility.

A cache TTL of 1000 lasts longer than expected. Integer TTLs are seconds; TimerX integer intervals are milliseconds.

A default result appears successful. Null OperCode means success. Track execution state separately.

Queue backlog or unexpected consumption order. Check for multiple consumers, then review capacity, throughput and shutdown draining.

A limiter wait cannot be cancelled. Current WaitAsync() has no token overload. Use WaitLock for cancellable acquisition. Never abandon a pending permit wait.

Cron runs too often. Expressions start with seconds. Check six-field order and the deployment timezone.

A startup module does not run. Check Generator installation, actual runner calls and order attributes on referenced classes.

JSON fails under AOT. Cover DTOs, collections, envelopes and dynamic values with generated metadata; verify the real publication mode.

Source is under TUtility/src/TUtility.Core, TUtility/src/TUtility, TUtility/src/TUtility.App and TUtility/analyzer.