Validating PowerShell script syntax in GitHub Actions workflows

 
 
  • Gérald Barré
When writing GitHub Actions workflows, it is generally recommended to keep your scripts in separate files and reference them using the path attribute of the run step. This allows you to lint and test your scripts easily using standard tools. However, this approach is not always practical. For instance, when creating a reusable workflow or a simple action, you might prefer to keep everything in a single… [read more]

Getting more information in MSBuild binlogs with property tracking

 
 
  • Gérald Barré
MSBuild binary logs (binlogs) are a powerful tool for diagnosing build issues. If you're not familiar with binlogs, check out my post Exploring a MSBuild binary log using the binary log viewer to get started, or Stop using diagnostic verbosity in MSBuild to understand why binlogs are better than diagnostic verbosity. By default, binlogs capture a lot of information, but you can get even more details about… [read more]

Retrieve method source file location at runtime using Portable PDBs in .NET

 
 
  • Gérald Barré
When debugging or logging, you often need to know where a method is defined in your source code. While .NET provides caller information attributes like [CallerMemberName], [CallerFilePath], and [CallerLineNumber], these only work at compile-time and require you to add parameters to your methods. What if you want to retrieve source file information for any method at runtime? One use-case is… [read more]

Zero-copy BinaryData creation from MemoryStream in .NET

 
 
  • Gérald Barré
When working with BinaryData and MemoryStream in .NET, you might need to convert stream data into a BinaryData instance. The typical approach using BinaryData.FromStream() involves copying the entire buffer, which can impact performance and increase memory allocations. However, there's a more efficient way to achieve this with zero memory copies. The problem with BinaryData.FromStream() The standard way… [read more]

Understanding and Managing Mark of the Web in .NET

 
 
  • Gérald Barré
What is Mark of the Web? Mark of the Web (MOTW) is a Windows security feature that protects users from potentially unsafe files downloaded from the internet. When you download a file, Windows automatically adds a special metadata tag indicating the file originated from an untrusted source and may contain harmful content. Windows components such as Microsoft Edge and Windows Explorer use MOTW to determine… [read more]