Skip to main content

Posts

Github Copilot Edits

I continue my journey on getting the most out of Github Copilot. Today I want to take a look at Copilot Edits as another way to use AI in your day-to-day coding experience. Until recently, you either had to use completions or the chat experience.  With Copilot Edits, a third option is added to the list. Why Copilot Edits? Where the completions or the chat experience are a great fit for single file changes, they can be cumbersome for bigger changes that span multiple files. When using Copilot Edits, you can specify a set of files that should edited and then ask Copilot to do some changes.  Remark: At the moment of writing Copilot Edits seems only to be available inside VS Code and not (yet) in Visual Studio. Let’s give it a try… Click on the Github Copilot icon at the top and choose Open Copilot Edits from the dropdown(or just hit CTRL-Shift-I) This will open up the Copilot Edits view where we can start a new editing session .   First we need t...
Recent posts

Sequential GUIDs with .NET 9

Sequential GUIDs (Globally Unique Identifiers) are a specific type of GUID that are optimized for scenarios where insertion order matters, especially in databases. Traditional GUIDs are randomly generated and can cause performance issues in systems where GUIDs are used as primary keys due to their lack of natural order. Sequential GUIDs address this problem by maintaining some level of order, making them more efficient for certain use cases. Before .NET 9 I typically had 2 approaches to generate a sequential guid: I let the database generate the sequential guid for me through the NEWSEQUENTIALID function: I generate the id myself using a library like RT.Comb : Starting from .NET 9 I have a new option to add to my list as the Guid class got a new method Guid.CreateVersion7() ,  that returns sequential Guids, according to version 7 UUID RFC 9562. This means that they can be ordered and used as a database table primary key, for example, because the values won't be s...

From dependence to independence, to interdependence

Last week I was listening to an Coaching For Leaders podcast when Stephen M. R. Covey was the guest. Stephen is a bestselling author and former CEO Covey Leadership Center. Stephen is also the son of Dr. Stephen R. Covey’s, author of the well known 7 habits of highly effective people book. When asked about a key lesson from his father, Stephen talks about the evolution from dependence to independence to interdependence. Having never read the book, I though it would a good idea to a) Put the book on my reading list. b) Already dive in a little bit more into this topic. What did I learn? The basic idea is that personal and professional growth can be seen as a journey through three stages: dependence, independence, and interdependence. Each stage represents a significant transformation in how we relate to ourselves, others, and the world.   Dependence: The starting point Dependence is where we all begin. As children, we rely on our parents to meet our basic needs and ...

CS8999–Line does not start with the same whitespace

Raw string literals are a powerful feature introduced in C# 11 that simplify the way we handle strings, especially those containing special characters or spanning multiple lines. What are raw string literals? A raw string literal starts and ends with a minimum of three double-quote characters ( """ ). This allows you to include characters like backslashes ( \ ), single quotes ( ' ), and double quotes ( " ) without needing to escape them. Here's a simple example: The above example is a single line string literal. But the feature really shines when using raw string literals to span multiple lines. This is particularly useful for embedding large blocks of text, such as XML or JSON, directly into your code. Remark: It is very important to check the documentation as some very specific rules are applicable when using multiline string literals. I stumbled over this myself when I added a JSON schema description inside a piece of code: The compiler c...

Semantic Kernel - Structured output

One of the challenges when integrating a large language model into your backend processes is that the response you get back is non-deterministic. This is not a big problem if you only want to output the response as text, but it can be a challenge to process the response in an automated fashion. Prompting for JSON Of course you can use prompt engineering to ask the LLM to return the response as JSON and even provide an example to steer the LLM, but still it can happen that the JSON you get back is not formatted correctly. Here is a possible prompt: A trick that also can help as mentioned in the Anthropic documentation is to prefill the response with a part of the JSON message. JSON mode Although the techniques above will certainly help, they are not fool proof. A first improvement on this approach was the introduction of JSON mode in the OpenAI API. When JSON mode is turned on, the model's output is ensured to be valid JSON, except for some edge cases that are descri...

Who owns AI in your organization?

AI is the new shiny toy in many organizations, promising innovation, efficiency, and a competitive edge. But with great potential comes great complexity—and in many cases, inter-departmental turf wars over who should "own" AI. IT wants control for its infrastructure expertise, Data Science claims it as their domain due to their deep knowledge of models and analytics, and business units see it as a tool to drive their specific goals. So, who really owns AI? I think that’s the wrong question to ask…. AI’s transformative potential means it touches almost every part of an organization. Each department has valid reasons for their claim, but this fragmented approach can lead to inefficiencies, duplicated efforts, and missed opportunities. AI is not a standalone tool that fits neatly into one department. In my opinion it’s a cross-functional enabler that thrives on collaboration. Framing AI as something to be "owned" misses its broader organizational value. Instead...

Efficient searching in .NET with SearchValues

While browsing through the list of changes in .NET 9, I noticed a remark about the SearchValues functionality. I had no idea what it does so time to further investigate this feature... The SearchValues<T> type was introduced in .NET 8 to help optimize search. It allows us to specify the values we want to search for. Based on the provided values the runtime will come up with different strategies to optimize the search performance. After the SearchValues<T> is created, we can use it on any ReadOnlySpan<T> . Here is a small example: In .NET 8, the SearchValues was limited to simple data types like char. Starting from .NET 9, you can also use string values: Remark: Use SearchValues<T> when you expect to use the same search values a lot. More information SearchValues Class (System.Buffers) | Microsoft Learn SearchValues<T> Class (System.Buffers) | Microsoft Learn What's new in .NET 9 | Microsoft Learn