skip to content
Relatively General .NET

The .NET MAUI Extension for Visual Studio Code is now Generally Available

by Maddy Montaquila

posted on: June 12, 2024

Start developing .NET MAUI apps with the GA Visual Studio Code extension today!

Building Generative AI apps with .NET 8

by Jordan Matthiesen

posted on: June 11, 2024

Learn the latest news and announcements about the state of generative AI development with .NET 8.

Introducing collection expressions in C#12

by Andrew Lock

posted on: June 11, 2024

Behind the scenes of collection expressions - Part 1

Getting started with UI testing .NET MAUI apps using Appium

by Gerald Versluis

posted on: June 10, 2024

A proven way to test your (mobile) apps is through UI testing. In this post we will learn how to get setup with UI testing for .NET MAUI apps using Appium.

Sharing the Renovate configuration across multiple projects

by

posted on: June 10, 2024

Renovate is a tool that helps you to keep your dependencies up-to-date. You can configure Renovate using a configuration file at the root of the repository. In this post, I describe how to share the Renovate configuration across multiple projects.Developers don't like to maintain the same configura

The code that lived in my head rent free for 30 years

by Oren Eini

posted on: June 07, 2024

I have a piece of code that has been living, rent-free, in my head for the past 30 years or so.In middle school (I was 12 - 13 at the time), I was taught Pascal as the entry-level programming language. I found it to be a really fascinating topic, as you can imagine. One of the things I did was try to read other people’s code and see what sense I could make out of it. That was way before the Internet was a thing, though. Even at that time, Pascal was mostly on its way out, and there wasn’t much code that a kid could access. To give some context, at the time, if you wanted to move data from one place to the next, the only real option was to physically disassemble your computer, take out the hard disk, wrap it in a towel for protection, and carry it to your destination. I recall doing that and then spending some hours at a friend’s house, trying to figure out the right jumper configuration so the BIOS would recognize two drives at once. Because of this, I had a great interest in disk parking, a technique that helps ensure that taking the hard drive from one location to the next wouldn’t ruin it. I remember running into a particular piece of code to handle disk parking in Pascal and being quite excited by this. Here I had something that I needed to do, and also in a language that I was familiar with. I remember staring at the code and trying to make sense of it for a while. I couldn’t figure it out. In fact, I couldn’t even begin to understand what was going on there. I remember feeling both frustrated and stupid because I could understand the syntax but not what it was doing.In fact, it was so far above my head that I was upset about it for days, to the point that decades later, it still pops into my head. When it came back for a visit this week, I decided to try to figure it out once and for all. That led to the first problem, which is that I cannot actually recall the code. I remember it was in Pascal, that it dealt with parking the disk needles, and it was full of weird numbers that I couldn’t grasp.  Turning to Google didn’t help much, I found some code samples, but nothing that really jived with what I recalled. I ended up cobbling something that more or less matches what I had in my head. program DiskPark; function ParkHead(drive: char): Boolean; var regs: Registers; begin with regs do begin AH := $13; AL := Ord(drive) - Ord('A') + $80; DL := AL; Intr($13, regs); ParkHead := (Flags and FCarry) = 0; end; end; begin if ParkHead('A') then WriteLn('Success: parked') else WriteLn('Failure, no idea why!'); end.The actual code that I remember was beefier, and I think that it handled a bunch of additional scenarios, but it had been 30 years, I can’t recall it. Amusingly enough, I actually had to update my publishing software, since I never thought I would be publishing Pascal code snippets 🙂.What is interesting is that, as I look at this code and try to view it through the glasses of my 12-year-old self, I can understand exactly the frustration. Look at this code, it is filled with random numbers and letters. What is AH or the Intr() call? I mean, looking at this, there is no place to get started understanding this.Let’s look at this line:AH := $13;There is no definition of AH anywhere, I can’t tell where it is coming from. And $13, what is that about? A bad luck omen because I can’t figure it out, I think…The problem was that my 12-year-old self wrote programs like “Guess the number”, and really advanced stuff was bubble sort. I approached the code above with the same mindset. There is a logic to this that I can figure out if I can just stare at this long enough.The problem is that the code above is basically arbitrary, there is nothing intrinsic about it.The weird variables that come from nowhere (AL, DL, and AH) are registers (at the time, I don’t believe I was even aware that those existed). The weird numbers are just arguments that we pass to the BIOS when you invoke a command. In the same sense, consider this code:return syscall(437, ptr, 525376);This line will tell you absolutely nothing about the reasoning behind the code. While the numbers seem arbitrary,in this case, they correspond to calling SYS_openat with the flags O_APPEND | O_CREAT | O_CLOEXEC. The whole program above is just the way you have to go to invoke a system call (as we would call it today), and there is no logic or sense to it. Just something that you have to know. And once you do know, all of this can be packaged into a much simpler, higher-level concept: the system call. (Yes, it is an interrupt invocation, not the same thing. You may go stand in the pedantic corner, mind.)Hopefully, I wouldn’t ever have to think about this program any longer. I managed to not only understand what it does, but actually grok it.

Announcing the official OpenAI library for .NET

by .NET Team

posted on: June 06, 2024

The initial beta release of the official OpenAI library for .NET is now available.

MSTest 3.4 is here with WinUI support and new analyzers!

by Amaury Levé

posted on: June 05, 2024

MSTest 3.4 is available. Learn all about the highlighted features and fixes that will make your testing experience always better.

A beginner’s guide to mapping arrays in EF Core 8

by Arthur Vickers

posted on: June 04, 2024

EF Core 8 introduces support for mapping typed arrays of simple values to database columns so the semantics of the mapping can be used in the SQL generated from LINQ queries.

Conditionally skipping a trigger job in GitLab based on a previous job

by Andrew Lock

posted on: June 04, 2024

In this post I describe the approaches I explored to conditionally skip a trigger job in GitLab based on a previous job using dynamic pipelines…