In my work as a software developer, I have already been involved in numerous existing .NET software projects. Nearly all of these existing code bases had at least one thing in common: application configuration was not obvious. But why? Especially in the .NET ecosystem everything required to make it obvious is there. In this blog... Continue Reading →
[HOWTO] Run ASP.NET Core integration tests in a Az DevOps YAML pipeline when subject under test uses DefaultAzureCredential
Last week I struggled (again) running ASP.NET Core integration tests for an ASP.NET Core Web API that uses DefaultAzureCredential in a Azure DevOps YAML pipeline. To avoid having to struggle again, I am writing down my findings here. The initial situation There was an existing ASP.NET Core (.NET 8) Web API project that uses DefaultAzureCredential... Continue Reading →
[HOWTO] Rotate Azure Key Vault secrets used by an ASP.NET Core Web API with Terraform on every deployment
The blog post details the process of rotating secrets stored in Azure Key Vault with each application deployment, utilizing Infrastructure as Code (IaC) principles via Terraform. It emphasizes the importance of secret rotation to minimize risks from leaks. An ASP.NET Core Web API is demonstrated as the application example, alongside procedural GitHub Actions for deployment.
[HOWTO] Implement offline capability for Blazor PWA using Service Worker and local storage
In spring 2024, I developed offline capabilities for a Blazor Progressive Web App consisting of a .NET Web API and Blazor WASM client. This involved storing form data in local storage when offline and syncing the data when online again. The solution uses service worker to cache necessary assets, ensuring users could access forms without an internet connection.
[Workaround] Fix Testcontainers.SQL error “Docker.DotNet.DockerApiException : Docker API responded with status code=Conflict”
Recently an error occurred in an Azure DevOps build pipeline due to a conflict with a non-running Docker container, impacting integration tests using Testcontainers.MsSql. A workaround was suggested to resolve compatibility issues on Linux by updating the Docker image used by Testcontainers.MsSql.
[HOWTO] Report code coverage of .NET solution in SonarCloud when using Azure DevOps Microsoft-hosted linux agent
This blog post discusses the integration of SonarCloud code coverage reporting in an Azure DevOps YAML pipeline for .NET projects. It highlights adjustments needed when running such a pipeline on Azure DevOps Microsoft-hosted linux agents.
[Workaround & Headache Prevention] Successfully create teams channel notification subscription with Microsoft Graph .NET Client Library v5
When upgrading from Microsoft Graph .NET Client Library v4 to v5, adapting GraphServiceClient methods for team channel notification subscriptions according to official documentation caused issues. Despite the recommended code changes, they did not work as expected. After extensive debugging and research, a workaround was found to resolve the issue. This is a known issue with POST requests in v5.
[HOWTO] Configure Serilog for a .NET Core Web API running on Azure App Service
This blog post guides the configuration of Serilog for a .NET Core Web API running on an Azure App Service. It covers logging requirements and implementation, including Serilog setup in Program.cs and appsettings.json. It also provides instructions for querying logs in Azure Application Insights and streaming them using Log Stream in Azure App Service.
Continuous Integration and Continuous Deployment with JetBrains Space
The author was tasked with setting up a CI/CD process for a Blazor application using JetBrains Space. They had experience with other tools like Azure DevOps and GitHub Actions but found implementing pipelines in Space challenging. They struggled with creating the necessary automation scripts and host parameters. Despite good documentation, they found the CI/CD features lacking in predefined steps and tasks for standard cases, leading to unnecessary effort. They were also concerned about the exposure of project-wide secrets as plain text in runtime parameters.
[FollowUp] Using Testcontainers in integration tests for ASP.NET Core Web API
The blog post discusses transitioning from SQLite to Testcontainers for .NET to run integration tests for ASP.NET Core applications. The author encountered limitations with SQLite when running complex Linq queries. While alternatives like Mocking, EF Core In-Memory Database Provider, and LocalDB were considered, these were found to be wanting. Instead, Testcontainers was chosen for its simple setup, good documentation, and excellent integration with MSSQL servers. This approach does necessitate Docker being installed and operational on the local development environment.
