API reference and troubleshooting
On this page
Core types
| Type | Package / namespace | Topic |
|---|---|---|
MemoryCache / MemoryCache<TKey,TValue> | Core · TUtility.Caching | Caches |
ObjectPool<T> / UltraMpscQueue<T> | Core · TUtility | Pools and queues |
AsyncConcurrencyLimiter / WaitLock / AsyncAutoResetEvent | Core · TUtility | Async coordination |
TimerX / TimerScheduler / Cron | Core · TUtility | Scheduling |
IScheduledTask / CronScheduledTask | Core · TUtility | Scheduled work |
CrcHelper / YitIdHelper | Core · TUtility | Data |
BitHelper / ConvertHelper | Core · TUtility.BitExtension / TUtility.Extension | Bits and conversion |
SystemTextJsonService | Core · TUtility.Json.Extension | JSON |
PagedList<T> / BasePageInput | Core · TUtility | Paging |
ImportPreviewOutput<T> / ImportPreviewListOutput<T> | Core · TUtility | Import preview |
OperResult / OperResult<T> | TUtility · TUtility | Results |
XTrace / TextFileLog | TUtility · TUtility.Log | Logging |
AppStartup / App / AppDataPaths | App · TUtility | Hosting |
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
| Member | Result | Parameters and constraints |
|---|---|---|
MemoryCache<TKey,TValue>.Set(key, value, expire) | bool | Integer TTL uses seconds; negative values use the cache’s default Expire |
TryGetValue(key, out value) | bool | Use the return value to distinguish a hit from a default-valued item |
AsyncConcurrencyLimiter.WaitAsync() | ValueTask | No cancellation token; release in finally after successful acquisition |
WaitLock.WaitAsync(cancellationToken) | Task | Cancellable wait; never release a permit you did not acquire |
WaitLock.WaitAsync(millisecondsTimeout, cancellationToken) | Task<bool> | False on timeout; only true owns a permit |
ImportPreviewOutputBase.Results | SynchronizedList<ImportPreviewResult> | Adding a failure does not update HasError or DataCount |
OperResult.IsSuccess | bool | Null 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.