Talk - Bringing C# nullability into existing code
Maarten Balliauw Blog
by Maarten Balliauw
2M ago
Related resources Nullable reference types in C# Internals of C# nullable reference types Annotating your C# code Techniques and tools to update your project Talk abstract The C# nullability features help you minimize the likelihood of encountering that dreaded System.NullReferenceException. Nullability syntax and annotations give hints as to whether a type can be nullable or not, and 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 bases is a Herculean effort. There’s much more ..read more
Visit website
Test-Driving Windows 11 Dev Drive for .NET
Maarten Balliauw Blog
by Maarten Balliauw
5M ago
At Build 2023 back in June, Microsoft announced a new form of storage volume for Windows 11: Dev Drive. In October 2023, support for Dev Drive was shipped as a Windows Update and now available to anyone using the latest version of Windows 11. Dev Drive promises better performance for typical developer workloads, where faster file I/O performance matters. It is built on the newer Resilient File System (ReFS) as opposed to the default NT File System (NTFS) on Windows, and combined with the new performance mode of Microsoft Defender Antivirus, promises an up to 30% performance increase for overal ..read more
Visit website
Provide opt-in to experimental APIs using C#12 ExperimentalAttribute
Maarten Balliauw Blog
by Maarten Balliauw
5M ago
When writing libraries and frameworks that others are using, it’s sometimes hard to convey that a given API is still considered “experimental”. For example, you may want to iterate on how to work with part of the code base with the freedom to break things, while still allowing others to consume that code if they are okay with that. In some programming languages, like Kotlin, it’s possible to require opt-in to use certain APIs. This mechanism lets library authors inform users of their APIs about specific conditions, for example, if an API is experimental and subject to change, and require expli ..read more
Visit website
Discriminated Unions in C#
Maarten Balliauw Blog
by Maarten Balliauw
7M ago
Discriminated unions have been a long-standing request for C#. While F# users have had discriminated unions for years, C# developers will have to wait a bit longer. What discriminated unions allow you to do is tell the compiler (and other tooling like your IDE) that data can be one of a range of pre-defined types. For example, you could have a method RegisterUser() that returns either a User, a UserAlreadyExists or InvalidUsername class. These classes don’t have to inherit from each other. You want to support 3 potential return types and tell the language about this, get compiler errors if you ..read more
Visit website
Running Large Language Models locally – Your own ChatGPT-like AI in C#
Maarten Balliauw Blog
by Maarten Balliauw
11M ago
For the past few months, a lot of news in tech as well as mainstream media has been around ChatGPT, an Artificial Intelligence (AI) product by the folks at OpenAI. ChatGPT is a Large Language Model (LLM) that is fine-tuned for conversation. While undervaluing the technology with this statement, it’s a smart-looking chat bot that you can ask questions about a variety of domains. Until recently, using these LLMs required relying on third-party services and cloud computing platforms. To integrate any LLM into your own application, or simply to use one, you’d have to swipe your credit card with Op ..read more
Visit website
Mastodon on your own domain without hosting a server
Maarten Balliauw Blog
by Maarten Balliauw
1y ago
Like many in the past week, I have been having a serious look at Mastodon as an alternative to Twitter. Mastodon is a social network that is distributed across many servers that have their own smaller communities, and federate with other servers to provide a more “global” social network. There are many servers out there that you can choose from. Alternatively, you can also self-host your Mastodon server, or use one of many hosted instances, “Mastodon as a service”. In recent hours, I have seen many people wanting to host their own servers, which is great fun! Self-hosting also has the added be ..read more
Visit website
Rate limiting in web applications - Concepts and approaches
Maarten Balliauw Blog
by Maarten Balliauw
1y ago
Your web application is running fine, and your users are behaving as expected. Life is good! Is it, though…? Users are probably using your application in ways you did not expect. Crazy usage patterns resulting in more requests than expected, request bursts when users come back to the office after the weekend, and more! On This Page Introduction to rate limiting Why rate limiting? What is rate limiting? What should I rate limit? Naive rate limiting Rate limiting algorithms Quantized buckets / Fixed window limit Token buckets Deciding rate limits Which resources to rate limit? What are s ..read more
Visit website
ASP.NET Core rate limiting middleware in .NET 7
Maarten Balliauw Blog
by Maarten Balliauw
1y ago
Rate limiting is a way to control the amount of traffic that a web application or API receives, by limiting the number of requests that can be made in a given period of time. This can help to improve the performance of the site or application, and to prevent it from becoming unresponsive. Starting with .NET 7, ASP.NET Core includes a built-in rate limiting middleware, which can be used to rate limit web applications and APIs. In this blog post, we’ll take a look at how to configure and use the rate limiting middleware in ASP.NET Core. What is rate limiting? Every application you build is shari ..read more
Visit website
How to test ASP.NET Core Minimal APIs
Maarten Balliauw Blog
by Maarten Balliauw
2y ago
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. By the end of this post, you will have a good understanding of how to make sure your ASP ..read more
Visit website
Techniques and tools to update your C# project - Migrating to nullable reference types - Part 4
Maarten Balliauw Blog
by Maarten Balliauw
2y ago
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: Nullable reference types in C# Internals of C# nullable reference types Annotating your C# code Techniques and tools to update your project (this post) Pick your approach: there is no silver bullet As we have seen in a previous post, it can be an overwhelming experience to go all-in ..read more
Visit website

Follow Maarten Balliauw Blog on FeedSpot

Continue with Google
Continue with Apple
OR