You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+96-67Lines changed: 96 additions & 67 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,49 +1,51 @@
1
-
2
1
# NuExt.System
3
2
4
-
`NuExt.System` is a **lightweight, production-ready foundation** for everyday .NET development. It brings together high-quality utilities for **asynchrony**, **lifetime management**, **threading primitives**, **high-performance spans/memory helpers**, **diagnostics**, and **collection helpers** — all with a strong focus on **performance**, **correctness**, and **developer ergonomics**.
5
-
Use it to reduce boilerplate, standardize common patterns across projects, and keep code fast and clean across modern .NET and .NET Framework.
3
+
`NuExt.System` is a **lightweight, production-ready foundation** for everyday .NET development. It brings together high-quality utilities for **asynchrony**, **lifetime management**, **threading primitives**, **high‑performance spans/memory helpers**, **diagnostics**, and **collection helpers** — all with a strong focus on **performance**, **correctness**, and **developer ergonomics**. Use it to reduce boilerplate, standardize common patterns across projects, and keep code fast and clean across modern .NET and .NET Framework.
-`PathUtilities` — static helpers for common path operations
22
25
-**Diagnostics & utilities**
23
-
-`ProcessMonitor`, `PerformanceMonitor`, `EnumHelper<T>`, `TypeExtensions`, and more
26
+
-`ProcessMonitor`, `PerformanceMonitor`, `EnumHelper<T>`, `TypeExtensions`, etc.
24
27
25
28
### Span / MemoryExtensions Polyfills
26
29
27
-
This package includes **polyfills (API backports)** for selected `Span` / `MemoryExtensions`-style APIs from newer .NET versions.
28
-
On modern runtimes, it transparently uses the inbox implementations; on older runtimes, it provides compatible behavior with the same semantics.
30
+
This package includes **polyfills (API backports)** for selected `Span` / `MemoryExtensions`‑style APIs from newer .NET versions. On modern runtimes, it transparently uses the inbox implementations; on older runtimes, it provides compatible behavior with the same semantics.
The `ReentrantAsyncLock` provides a context-aware reentrant async lock. It uses `AsyncLocal` to track ownership across awaits, allowing the same logical flow to re-enter without deadlocks.
113
+
awaitlifetime.DisposeAsync(); // disposes in the right order, async‑aware
114
+
```
92
115
93
-
In scenarios that capture **ExecutionContext** (e.g., `CancellationToken.Register`), prefer suppressing the flow to avoid leaking `AsyncLocal` state into callbacks:
116
+
### 3) Zero‑alloc string building with `ValueStringBuilder`
94
117
95
118
```csharp
96
-
varasyncLock=newReentrantAsyncLock();
97
-
varcts=newCancellationTokenSource();
119
+
Span<char>initial=stackallocchar[128];
120
+
varsb=newSystem.Text.ValueStringBuilder(initial);
98
121
99
-
asyncLock.Acquire(() =>
100
-
{
101
-
//Don't capture the current ExecutionContext and its AsyncLocals for CancellationToken.Register
102
-
using (ExecutionContext.SuppressFlow())
103
-
{
104
-
cts.Token.Register(() =>asyncLock.Acquire(() =>
105
-
{
106
-
// user code
107
-
}));
108
-
}
109
-
//The current ExecutionContext is restored after exiting the using block
Includes code derived from the .NET Runtime, licensed under the MIT License. The original source code can be found in the [.NET Runtime GitHub repository](https://github.com/dotnet/runtime).
260
+
Some implementations are derived from the .NET Runtime (MIT). See LICENSE and source comments for attributions.
232
261
233
-
###Contributing
262
+
## Contributing
234
263
235
264
Issues and PRs are welcome. Keep changes minimal and performance-conscious.
0 commit comments