Enable SHA Pinning for GitHub Actions Across Personal Repositories

 
 
  • Gérald Barré
Pinning GitHub Actions to a full-length commit SHA is one of the simplest ways to reduce supply chain risk in your workflows. It ensures that a workflow keeps using the exact code you reviewed, instead of silently following a moving tag or branch. Tags are convenient, but they are mutable. A workflow that uses actions/checkout@v4 or a third-party action pinned to a tag can start running different code… [read more]

Number comparison in .NET: ==, Equals, and IEEE 754 edge cases

 
 
  • Gérald Barré
When people compare numbers, they usually expect a simple rule: same value means equal. For floating-point numbers (Half, float, and double), there are actually two useful notions of equality in .NET: IEEE comparison semantics, used by == equivalence semantics for .NET objects, used by Equals At first sight this looks inconsistent. In practice, each one solves a different problem. Quick behavior matrix… [read more]

Generate a Kiota client at build time from an ASP.NET Core OpenAPI file

 
 
  • Gérald Barré
In a previous post, I explained how to generate the OpenAPI document during the ASP.NET Core build and commit it to the repository. That gives you a versioned API contract that is easy to review in pull requests. In this post, let's go one step further: use that generated OpenAPI file as the input for Kiota, so your typed .NET client is also generated during build. The goal is simple: The server produces… [read more]

New features and Roslyn analyzers for Meziantou.Framework.FullPath

 
 
  • Gérald Barré
A few years ago, I introduced , a library to ensure you always deal with full paths in your applications and provide common methods to manipulate them easily. Recently, I've added new features to the library, including new methods and a set of Roslyn analyzers to help you use the library correctly. The main idea of FullPath is to avoid bugs related to relative paths by forcing the use of absolute paths… [read more]

PowerShell Parameter Validation Attributes

 
 
  • Gérald Barré
PowerShell provides a set of validation attributes that enforce constraints on parameters and variables. These attributes validate input at runtime, making your scripts more robust and reducing the need for manual validation logic. Overview Validation attributes can be applied to: Function or script parameters Script-level variables Class properties When validation fails, PowerShell throws an exception… [read more]

Using the Unicode Fraction Slash instead of HTML sub/sup tags

 
 
  • Gérald Barré
When you need to display fractions in HTML, you might reach for the <sub> and <sup> tags. However, there's a simpler Unicode-based alternative: the fraction slash character (U+2044). What is the Fraction Slash? The fraction slash (⁄) is a Unicode character that automatically formats surrounding digits as a fraction. When placed between two digits, most modern browsers and fonts render it as a proper… [read more]

Blazor - How to set a base component for all Razor components

 
 
  • Gérald Barré
When building a Blazor application, you may want a custom base component for all your Razor components. This is useful for sharing common functionality like cancellation tokens, logging, or state management across all components. Instead of adding @inherits YourBaseComponent to every Razor file, you can use the _Imports.razor file to set it globally. Using _Imports.razor to set a default base component… [read more]