Deleting GitHub Actions artifacts using the GitHub REST API

  • Gérald Barré
GitHub Actions supports sharing data between jobs in any workflow as artifacts. This is very convenient but the storage is limited (or you have to pay for it). If you use too much storage, you may get one of those notifications: You've used 75% of included services for GitHub Storage (GitHub Actions and Packages) One way to free storage space is to delete GitHub Actions artifacts. You can do it manually,… [read more]

Getting Roslyn (C# compiler) and Language versions

  • Gérald Barré
When a user reports an error in a Roslyn Analyzer or a Source Generator, you may need to know the version of Roslyn and the language version that are currently being used. The compiler provides everything needed. Indeed, you simply need to add #error version to any source file and check the compiler output: #error version // ... rest of the file ... The error message CS8304 will contain the version of… [read more]

Distributing applications that depend on Microsoft.Playwright

  • Gérald Barré
To use Playwright, you need to install the NuGet package and the browsers. The documentation tells us to use the following command to install the browsers: # Create project dotnet new console -n PlaywrightDemo cd PlaywrightDemo # Install dependencies, build project and download necessary browsers. dotnet add package Microsoft.Playwright dotnet build dotnet tool install --global Microsoft.Playwright.CLI… [read more]

Updating your project to use File Scoped Namespaces

  • Gérald Barré
File Scoped Namespace is a new feature of C# 10. The idea is to remove one level of indentation from source files when they contain only one namespace in it. The goal is to reduce horizontal and vertical scrolling and make the code more readable. namespace MyProject { class Demo { } } // File Scoped Namespace namespace MyProject; class Demo { } Most of the files have only one namespace, so File Scoped… [read more]

Monitoring a .NET application using OpenTelemetry

  • Gérald Barré
note: The samples in this post instrument an ASP.NET Core application, but you can instrument any kind of application using OpenTelemetry What is OpenTelemetry? OpenTelemetry is a set of APIs, SDKs, tooling and integrations that are designed for the creation and management of telemetry data such as traces, metrics, and logs. The project provides a vendor-agnostic implementation that can be configured to… [read more]

File upload with progress bar in Blazor

  • Gérald Barré
Uploading files may take times. The users want to have visibility on what's happening, so it is good to show them about the progress. The simplest way to do it is to show a progress bar. In this post, we'll use the InputFile component to upload files and some custom code to show the progress bar. The result looks like this: Blazor comes with the InputFile component. This component allows you to upload… [read more]