Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 100 additions & 0 deletions .github/workflows/build-samples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ on:
- "cloud-native/health-resilience-zero-downtime/**"
- "cloud-native/polly-resilience/**"
- "csharp-language/csharp-12-features/**"
- "csharp-language/high-performance-memory-management/**"
- ".github/workflows/build-samples.yml"

pull_request:
Expand All @@ -42,6 +43,7 @@ on:
- "cloud-native/health-resilience-zero-downtime/**"
- "cloud-native/polly-resilience/**"
- "csharp-language/csharp-12-features/**"
- "csharp-language/high-performance-memory-management/**"
- ".github/workflows/build-samples.yml"

workflow_dispatch:
Expand Down Expand Up @@ -794,3 +796,101 @@ jobs:
)"

test "${line_count}" = "7"

test-high-performance-pipelines:
name: Test UTF-8 pipelines log ingestor
runs-on: ubuntu-latest

permissions:
contents: read

steps:
- name: Check out repository
uses: actions/checkout@v5

- name: Install .NET 10 SDK
uses: actions/setup-dotnet@v5
with:
dotnet-version: "10.0.x"

- name: Restore
run: >
dotnet restore
csharp-language/high-performance-memory-management/HighPerformanceLogIngestor.slnx

- name: Build
run: >
dotnet build
csharp-language/high-performance-memory-management/HighPerformanceLogIngestor.slnx
--configuration Release
--no-restore

- name: Test
run: >
dotnet test
csharp-language/high-performance-memory-management/HighPerformanceLogIngestor.slnx
--configuration Release
--no-build

- name: Verify explicit C# language version
shell: bash
run: |
app_version="$(
dotnet msbuild \
csharp-language/high-performance-memory-management/src/HighPerformanceLogIngestor/HighPerformanceLogIngestor.csproj \
-getProperty:LangVersion
)"

test_version="$(
dotnet msbuild \
csharp-language/high-performance-memory-management/tests/HighPerformanceLogIngestor.Tests/HighPerformanceLogIngestor.Tests.csproj \
-getProperty:LangVersion
)"

echo "Application LangVersion: ${app_version}"
echo "Test LangVersion: ${test_version}"

test "${app_version}" = "12.0"
test "${test_version}" = "12.0"

- name: Run deterministic ingestion sample
shell: bash
run: |
output="$(
dotnet run \
--project csharp-language/high-performance-memory-management/src/HighPerformanceLogIngestor/HighPerformanceLogIngestor.csproj \
--configuration Release \
--no-build
)"

printf '%s\n' "${output}"

printf -v expected '%s\n' \
'High-Performance UTF-8 Log Ingestor' \
'Lines: total=4, valid=3, invalid=1' \
'Accepted event IDs: 1001, 1002, 1004' \
'Levels: 1=1, 2=1, 4=1' \
'First message: Cache warmed' \
'Last message: Worker started'

expected="${expected%$'\n'}"

if [[ "${output}" != "${expected}" ]]; then
echo "Console output did not match the expected output."

diff \
--unified \
<(printf '%s\n' "${expected}") \
<(printf '%s\n' "${output}") \
|| true

exit 1
fi

line_count="$(
printf '%s\n' "${output}" |
wc --lines |
tr --delete ' '
)"

test "${line_count}" = "6"
57 changes: 40 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Each sample folder contains a focused implementation of one tutorial topic. The
| [`cloud-native/health-resilience-zero-downtime`](cloud-native/health-resilience-zero-downtime/) | Focused .NET 10 Orders API demonstrating tagged liveness/readiness checks, structured health output, shutdown readiness draining, typed HttpClient retries, circuit breaking, attempt timeouts, and deterministic integration testing | [.NET 8 Cloud-Native: Health Probes, Polly Resilience & Zero-Downtime Kubernetes Deployments](https://www.dotnet-guide.com/tutorials/cloud-native/health-resilience-zero-downtime/) |
| [`cloud-native/polly-resilience`](cloud-native/polly-resilience/) | Focused .NET 10 Polly v8 catalog sample demonstrating explicit stale-cache fallback, timeout-driven degradation, outbound concurrency isolation, strategy event counters, and deterministic integration testing | [Polly Resilience (Polly v8): Timeouts, Retries, Circuits, Bulkheads, Hedging](https://www.dotnet-guide.com/tutorials/cloud-native/polly-resilience/) |
| [`csharp-language/csharp-12-features`](csharp-language/csharp-12-features/) | Focused .NET 10 console lab locked to C# 12.0, demonstrating primary constructors with explicit properties, collection expressions and spreads, default lambda parameters, tuple-type aliases, deterministic output, and unit tests | [C# 12 Language Features: Primary Constructors, Collections & More](https://www.dotnet-guide.com/tutorials/csharp-language/csharp-12-features/) |
| [`csharp-language/high-performance-memory-management`](csharp-language/high-performance-memory-management/) | Focused .NET 10 UTF-8 ingestion sample demonstrating PipeReader framing, segmented ReadOnlySequence handling, span-based numeric parsing, bounded MemoryPool ownership, strict input validation, deterministic output, and tests | [High-Performance C#: Span<T>, Memory<T>, SIMD & Pipelines](https://www.dotnet-guide.com/tutorials/csharp-language/high-performance-memory-management/) |

## Companion articles
- [Common Microsoft.Extensions.AI mistakes](https://www.dotnet-guide.com/articles/dotnet-ai/microsoft-extensions-ai-common-mistakes/)
Expand Down Expand Up @@ -269,23 +270,45 @@ tutorials/
| |-- PollyCatalogResilience.Tests.csproj
| `-- CatalogResilienceTests.cs
|-- csharp-language/
| `-- csharp-12-features/
| |-- CSharp12RefactoringLab.slnx
| |-- README.md
| |-- src/
| | `-- CSharp12RefactoringLab/
| | |-- CSharp12RefactoringLab.csproj
| | |-- Program.cs
| | |-- Formatting/
| | | `-- TodoFormatter.cs
| | |-- Models/
| | | `-- TodoItem.cs
| | `-- Services/
| | `-- TodoService.cs
| `-- tests/
| `-- CSharp12RefactoringLab.Tests/
| |-- CSharp12RefactoringLab.Tests.csproj
| `-- CSharp12FeatureTests.cs
| |-- csharp-12-features/
| | |-- CSharp12RefactoringLab.slnx
| | |-- README.md
| | |-- src/
| | | `-- CSharp12RefactoringLab/
| | | |-- CSharp12RefactoringLab.csproj
| | | |-- Program.cs
| | | |-- Formatting/
| | | | `-- TodoFormatter.cs
| | | |-- Models/
| | | | `-- TodoItem.cs
| | | `-- Services/
| | | `-- TodoService.cs
| | `-- tests/
| | `-- CSharp12RefactoringLab.Tests/
| | |-- CSharp12RefactoringLab.Tests.csproj
| | `-- CSharp12FeatureTests.cs
| |-- high-performance-memory-management/
| | |-- HighPerformanceLogIngestor.slnx
| | |-- README.md
| | |-- src/
| | | `-- HighPerformanceLogIngestor/
| | | |-- HighPerformanceLogIngestor.csproj
| | | |-- Program.cs
| | | |-- Models/
| | | | `-- LogEntry.cs
| | | |-- Parsing/
| | | | |-- LogLineDecoder.cs
| | | | `-- Utf8LogLineParser.cs
| | | `-- Pipelines/
| | | |-- LogIngestionResult.cs
| | | `-- LogIngestor.cs
| | `-- tests/
| | `-- HighPerformanceLogIngestor.Tests/
| | |-- HighPerformanceLogIngestor.Tests.csproj
| | |-- HighPerformanceLogTests.cs
| | `-- TestSupport/
| | |-- ChunkedReadStream.cs
| | `-- SegmentedSequence.cs
|-- aspnet-core/
| |-- api-security-in-practice/
| | |-- ApiSecurityMinimal.slnx
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Solution>
<Folder Name="/src/">
<Project Path="src/HighPerformanceLogIngestor/HighPerformanceLogIngestor.csproj" />
</Folder>
<Folder Name="/tests/">
<Project Path="tests/HighPerformanceLogIngestor.Tests/HighPerformanceLogIngestor.Tests.csproj" />
</Folder>
</Solution>
Loading
Loading