Disable HTTP caching by default in ASP.NET Core APIs

 
 
  • Gérald Barré
When building APIs with ASP.NET Core, it's crucial to explicitly control caching behavior. Unlike web pages where caching often improves user experience, API responses should not be cached by default unless you intentionally design them to be cacheable. Unintended caching can lead to serious issues, including stale data, security vulnerabilities, and hard-to-reproduce bugs. Understanding HTTP caching… [read more]

Suppressing Roslyn Analyzer Warnings Programmatically using DiagnosticSuppressor

 
 
  • Gérald Barré
Roslyn analyzers are great for enforcing coding standards and finding bugs. However, they can sometimes report false positives or warnings you want to ignore in specific contexts. You can suppress these warnings using #pragma directives or [SuppressMessage] attributes, but both approaches require modifying the source code. A DiagnosticSuppressor is a Roslyn component that suppresses diagnostics reported… [read more]

Accessing files from the action repository in a GitHub Composite Action

 
 
  • Gérald Barré
GitHub Actions allows you to create reusable actions. One of the easiest ways to do this is to use Composite Actions, which let you combine multiple steps into a single action. This reduces code duplication across your workflows. When creating a composite action, you may need to reference files stored in the action repository, such as a PowerShell or Bash script. By default, when an action runs, the… [read more]

Implementing RFC-compliant HTTP caching for HttpClient in .NET

 
 
  • Gérald Barré
HTTP caching is one of the most effective ways to improve application performance by reducing network traffic, minimizing server load, and decreasing response times. While browsers automatically implement HTTP caching, the same isn't true for HttpClient in .NET, which processes every request independently without built-in caching support. This post shows how to add standards-compliant HTTP caching to… [read more]

Visualize GitHub Actions runs with Meziantou.GitHubActionsTracing

 
 
  • Gérald Barré
I recently released Meziantou.GitHubActionsTracing, a tool that converts GitHub Actions workflow runs into trace data. This post shows how to use it to debug slow or flaky CI pipelines with timeline-based analysis instead of relying on raw logs alone. Why GitHub Actions runs are hard to diagnose GitHub Actions logs are great for understanding what happened, but not for quickly seeing where time is spent.… [read more]

Creating case-sensitive folders on Windows using C#

 
 
  • Gérald Barré
Windows has long supported case-sensitive file operations, but the feature was not easily accessible or enabled by default. Since Windows 10 (version 1803), case sensitivity can be enabled on a per-directory basis. This feature was introduced primarily to support the Windows Subsystem for Linux (WSL), but any application can take advantage of it. This post covers how to enable case sensitivity for a… [read more]