Tag: General
All the articles with the tag "General".
-
How to test ASP.NET Core Minimal APIs
How do you test that your ASP.NET Core Minimal API behaves as expected? Do you need to deploy your application? Can you write tests with frameworks like xUnit, NUnit, or MSTest? In this post, you will learn the basics of testing ASP.NET Core Minimal APIs. You’ll get started with testing a “hello world” endpoint, and then test a more complex API that returns JSON data. You’ll finish with customizing the ASP.NET Core service collection, so you can customize services for your unit tests and integration tests.
-
Techniques and tools to update your C# project - Migrating to nullable reference types - Part 4
Previously, we saw how you can help the compiler’s flow analysis understand your code, by annotating your code for nullability. In this final post of our series, we’ll have a look at the techniques and tools that are available to migrate to using nullable reference types in an existing code base. In this series: As we have seen in a previous post, it can be an overwhelming experience to go all-in and enable the nullable annotation context for all projects in your solution.
-
Annotating your C# code - Migrating to nullable reference types - Part 3
In the previous post, we looked at some internals of C# nullable reference types, and the nullable annotation context. Today, let’s look at the many options for annotating your code and various ways to help the flow analysis understand your code. As a result, you (and anyone consuming your libraries) will get better and more reliable hints from the IDE and the C# compiler. In this series: So far, we’ve only been annotating our code with ? to inform flow analysis that a reference type can be null when nullable annotations are enabled. This one annotation may not be enough for all scenarios…
-
Internals of C# nullable reference types - Migrating to nullable reference types - Part 2
In the previous post, we saw that with nullable reference types enabled, you get better static flow analysis when working on your code. While nullable reference types don’t give you runtime safety, the design-time and compile-time help is priceless! In this post, we’ll look at some internals of how C# nullable reference types work, and how the C# compiler and IDE use the nullable annotation context. In this series: We’ve already seen there is a difference between nullability for value types and reference types.
-
Nullable reference types in C# - Migrating to nullable reference types - Part 1
The C# nullability features introduced in C#8 help you minimize the likelihood of encountering that dreaded System.NullReferenceException. Nullability syntax and annotations give hints on whether a type can be nullable or not. Better static analysis is available to catch unhandled nulls while developing your code. What’s not to like? Introducing explicit nullability into an existing code base is quite an effort. There’s much more to it than just sprinkling some ? and ! throughout your code. It’s not a silver bullet either: you’ll still need to check non-nullable variables for null.
-
A journey towards SpeakerTravel - Building a service from scratch
For close to two years now, I’ve had SpeakerTravel up & running. It’s a tool that helps conference organizers to book flights for speakers. You invite speakers, they pick their flight of choice (within a budget the organizer can specify), and the organizer can then approve and book the flight with a single click. In this post, I want to go a bit into the process of building this tool. Why I started it in the first place, how it works, a look at it from the business side, and maybe a follow-up post that covers any questions you may have after reading.
-
Custom bindings with Azure Functions .NET Isolated Worker
If you’re building workloads on Azure Functions, there’s a good chance you’ve looked at building custom bindings. Custom bindings can greatly reduce the boilerplate code you have to write in an Azure Function, so you can focus on the logic in your function instead. There are various examples of custom bindings out there, including several that I wrote while working on Indexing and searching NuGet.org with Azure Functions and Search. And then .NET 5 came, along with the new Azure Functions .NET Isolated Worker. Not a lot of documentation out there, and custom bindings don’t seem to work anymore…
-
Running a .NET application as a service on Linux with Systemd
In this post, let’s see how you can run a .NET Core / .NET 5 application as a service on Linux. We’ll use Systemd to integrate our application with the operating system and make it possible to start and stop our service, and get logs from it. To build my supply chain attack with .NET, I needed to host a DNS server to capture the hostnames sent to me. Let’s use that as an example!
-
Building a supply chain attack with .NET, NuGet, DNS, source generators, and more!
For a couple of months now, I’ve been pondering about what tools are at your disposal in .NET to help build and execute a supply chain attack. My goal was to see what is available out there, and what we, as .NET developers, should be aware of. Prepare for a long read! Now, forget that short introduction, and let’s start anew…
-
The process, thought and technology behind building a friendly .NET SDK for JetBrains Space
Early December 2020, we released JetBrains Space. Along with it, we built a Kotlin SDK and a .NET SDK. In this post, I want to walk you through the process of building that .NET SDK. This is another half-book blog post, so I’ve included a table of contents for you to jump to the parts you may be interested in. I’ve tried my best to build up the story, so of course, reading this post in full is highly appreciated. Let’s start with the basics…