Skip to main content

GUID vs LUUID: How to handle GUIDs in MongoDB with C#

LUUID vs GUID

Introduction In this blog post, we will discuss the differences between GUID and LUUID in MongoDB when working with C#. We will explore the default behavior of the MongoDB serializer and provide solutions to ensure compatibility between GUIDs and LUUIDs. Understanding the Issue When a C# GUID is saved in a MongoDB collection, it is […]

Options Pattern in ASP.NET Core

option-pattern

Introduction This post is about the Options Pattern in ASP.NET Core and how to use it to retrieve values from the AppSettings.json file. I will also explain how to inject the options into your classes and provides an example of using the Options Pattern in unit tests. What is the Options Pattern? The Options Pattern […]

How to Improve Testability and Mockability of NServiceBus

nservicebus_logo

Introduction In this blog post, we will address the challenge of testing and mocking the IMessageSession interface when using NServiceBus to send messages. We will explore a solution that involves creating a wrapper class, NServiceBusHelper, which can be injected into the constructor instead of the IMessageSession interface, making it mockable in integration tests. The problem […]

RabbitMQ – Change the timeout value for a queue

RabbitMQ

Introduction In this blog post, we will explore how to create a new queue in RabbitMQ and specify a timeout value. RabbitMQ, a widely-used message broker, allows for efficient communication between various components of a system. By setting a timeout for a queue, we can control how long messages are retained in the queue before […]

C# – Newtonsoft JSON serialization – String containing a DateTime

string serialization

Newtonsoft is known for their JSON library. Very useful and used everywhere, even for serialization of complex object in REST, NServicebus, … But in some specific cases, the behavior of this serializer / deserializer can be weird. My case here is about passing a String containing a DateTime, like: “2023-10-03T10:00:00Z”. Which is a UTC DateTime […]

How to fix RDP freezing on “Please Wait” screen

rdp please wait

Having to work on a remote machine every day, I’ve encountered a few times a really annoying issue: when you launch the MSTSC application and once connected to the remote machine, it says “Please Wait” forever. Especially when you don’t have admin rights on the machine you are on, there is not a lot you […]

C# – Split String with String delimiter

split string

The Split method from System.String doesn’t provide a simple way of splitting a String with a String delimiter. Instead it proposes to split it with a Char. Useful, but not enough… This is the way for splitting a String based on a String delimiter: Otherwise, if you just want to split the String based on […]

WPF – ShowDialog on top of the Main Window

hidden

Hi devz, While using a Microsoft.Win32 Dialog (OpenDialog or SaveDialog), it is possible that it will be opened behind the Main Window. So a good way to go back on that dialog is to use the ALT+TAB combo. But not really intuitive for the end user. The best way would be that this dialog is […]

C# – Open an already opened file

access-denied

Let’s say you want to open an Excel file by code but this Excel file is already opened by another user on another machine on a file share… You might encounter this issue: The process cannot access the file because it is being used by another process. But you still can open this file in […]

C# – Parse String Hour to TimeSpan or DateTime

timespanformatexception

Converting a String to something else can always be tricky. Especially if that String is about time. The thing is the fact that there are many ways to represent time and that can actually depend on the country you are. 6 PM, 6.00 PM, 06.00, 06:00, 18:00, 18h00, 18H00, they could be all the same. […]