~/devreads

#c#

95 posts

9 Jun

8 Jun

21 May

Richard Lander 47 min read

The `unsafe` keyword is being redesigned to mark caller-facing contracts rather than just syntax. Safety obligations between callers and callees become visible and reviewable. The model is motivated by the rise of AI-assisted code generation and arrives as a preview in .NET 11. The post Improving C# Memory Safety appeared first on .NET Blog.

.netaic#security.net 11

12 May

4 May

Jeremy Likness 9 min read

Build intelligent AI agents in .NET with the Microsoft Agent Framework. Learn how to create agents with tools, multi-turn conversations, memory, and graph-based workflows that bring together the building blocks from Parts 1 and 2. The post Microsoft Agent Framework – Building Blocks for AI Part 3 appeared first on .NET Blog.

.netaic#ai agentsmicrosoft agent framework

28 Apr

Jared Meade 13 min read

Adding caching to your application architecture can significantly improve key performance metrics, cut latency, and reduce load across downstream systems. In this walkthrough, we highlight the latest caching best practices and incorporate these design patterns into a reusable .NET application that you can reference when adding new capabilities to your application stack. The post High-Performance Distributed Caching with .NET and…

.netc#azure postgrescachingperformance

20 Apr

Drew Noakes 9 min read

The C# Dev Kit team replaced C++ Node.js addons with C# and Native AOT, removing a dependency on Python. This post walks through building a Node.js native addon entirely in C# using N-API, LibraryImport, and UnmanagedCallersOnly. The post Writing Node.js addons with .NET Native AOT appeared first on .NET Blog.

.netc#developer storiesvisual studio codec# dev kit

14 Apr

2 Apr

Bill Wagner 6 min read

C# 15 introduces union types — declare a closed set of case types with implicit conversions and exhaustive pattern matching. Try unions in preview today and see the broader exhaustiveness roadmap. The post Explore union types in C# 15 appeared first on .NET Blog.

.netc#.net 11pattern matchingunion types

23 Mar

Pablo Lopes, Bruno Capuano 4 min read

Announcement of Version 2 of Generative AI for Beginners .NET, a free course rebuilt for .NET 10 with Microsoft.Extensions.AI, updated RAG patterns, and new agent framework content across five structured lessons for building production-ready AI apps. The post Generative AI for Beginners .NET: Version 2 on .NET 10 appeared first on .NET Blog.

.net.net fundamentalsaiaspirec#

20 Mar

John Ruble 3 min read

Every project benefits from lightweight CLI scripts that can reach into your application code — for data seeding, format verification, one-off exports, and other tasks that don’t deserve a full endpoint or test harness but need access to your real domain logic. A few years ago, I wrote about adding CLI scripts to TypeScript/Node projects […] The post C# Finally…

c#.netscriptingc sharp

19 Mar

Ashley Schleining 3 min read

If multiple users can edit the same record, developers need to decide how your system handles that. If you don’t, EF Core decides for you. Designing Intentional Conflict Handling in .NET Applications By default, EF Core uses last write wins. The final call to SaveChanges() overwrites whatever came before it. There’s no warning and no […] The post Prevent Lost…

c#c sharp.net

12 Mar

10 Mar

9 Mar

5 Mar

Mike Kistler 17 min read

Discover what’s new in the v1.0 release of the official MCP C# SDK, including enhanced authorization, richer metadata, and powerful patterns for tool calling and long-running requests. The post Release v1.0 of the official MCP C# SDK appeared first on .NET Blog.

.netaic#mcpsdk

26 Feb

Jeremy Likness 8 min read

Discover how Microsoft.Extensions.VectorData brings unified vector database access to .NET - one interface for semantic search across any vector store with built-in support for embeddings, filtering, and RAG patterns. The post Vector Data in .NET – Building Blocks for AI Part 2 appeared first on .NET Blog.

.netaic#embeddingsmicrosoft.extensions.vectordata

10 Feb

28 Jan

Jeremy Likness 7 min read

Learn how Microsoft.Extensions.AI provides a unified API for building intelligent .NET applications with any LLM provider - one interface, endless possibilities, with built-in middleware, telemetry, structured outputs and more. The post .NET AI Essentials – The Core Building Blocks Explained appeared first on .NET Blog.

.netaic#generative aillm

26 Jan

5 Jan

31 Dec 2025

jonskeet 6 min read

As I’ve written before, I’m leaning heavily into immutability in the election site code. Until September 2025 (it’s taken a long time to get round to writing this blog post) that meant a combination of records, ImmutableList<T> and ImmutableDictionary<TKey, TValue>. In an ECMA C# standards meeting, however, Joseph Musser passed on some really valuable feedback … Continue reading Changing Immutable…

c#election 2029

30 Dec 2025

Jon Galloway 3 min read

Let's look back at the most-read .NET blog posts published in 2025, from .NET 10 to AI, performance, and developer tooling. The post Top .NET Blog Posts of 2025 appeared first on .NET Blog.

.netaiaspirec#cloud native

16 Dec 2025

8 Dec 2025

Wendy Breiding (SHE/HER), Eric Imasogie 3 min read

Explore how the Learn MCP server enhances the developer experience with Copilot, showcase practical examples, and provide straightforward integration instructions for Visual Studio, Visual Studio Code, the Copilot Command Line Interface, and the Copilot Coding Agent The post Microsoft Learn MCP Server Elevates Development appeared first on .NET Blog.

.netaic#visual studiovisual studio code

17 Nov 2025

Bill Wagner 8 min read

Learn what features are in C# 14, which ships as part of .NET 10. The post Introducing C# 14 appeared first on .NET Blog.

.netc#.net 10compound assignmentcsharp

28 Oct 2025

23 Oct 2025

14 Oct 2025

7 Oct 2025

24 Sept 2025

17 Sept 2025

9 Sept 2025

3 Sept 2025

25 Aug 2025

21 Aug 2025

20 Aug 2025

19 Aug 2025

Bruno Capuano 3 min read

Run GPT-OSS locally with C# and Ollama to build fast, private, offline AI The post GPT-OSS – A C# Guide with Ollama appeared first on .NET Blog.

.netaic#gptgpt-oss

12 Aug 2025

6 Aug 2025

5 Aug 2025

30 Jul 2025

29 Jul 2025

jonskeet 8 min read

In my previous blog post I described some behaviour of C# record types which was unexpected to me, though entirely correct according to the documentation. This is a follow-up post to that one, so if you haven’t read that one yet, please do so – I won’t go over all the same ground. Is this … Continue reading Records and…

c#election 2029

19 Jul 2025

jonskeet 7 min read

Unexpected inconsistency in records The other day, I was trying to figure out a bug in my code, and it turned out to be a misunderstanding on my part as to how C# records work. It’s entirely possible that I’m the only one who expected them to work in the way that I did, but … Continue reading Unexpected inconsistency…

c#

13 Apr 2025

jonskeet 10 min read

Postcodes After a pretty practical previous post about records and collections, this post is less likely to give anyone ideas about how they might tackle a problem in their own project, and doesn’t have any feature requests for Microsoft either. It’s an area I’ve found really fun though. An introduction to postcodes in the UK … Continue reading Election 2029:…

c#election 2029

27 Mar 2025

jonskeet 10 min read

Records and Collections This post is to some extent a grab-bag of points of friction I’ve encountered when using records and collections within the election site. Records recap This may end up being the most generally useful blog post in this series. Although records have been in C# since version 10, I haven’t used them … Continue reading Records and…

c#election 2029

4 Dec 2024

9 Jul 2024

jonskeet 14 min read

Introduction On Thursday (July 4th, 2024) the UK held a general election. There are many, many blog posts, newspaper articles, podcast episodes etc covering the politics of it, and the lessons that the various political parties may need to learn. I, on the other hand, learned very different lessons on the night of the 4th … Continue reading Lessons from…

c#general

23 Jun 2024

jonskeet 9 min read

Introduction I don’t know much about my blog readership, so let’s start off with two facts that you may not be aware of: I live in the UK. The UK has a general election on July 4th 2024. I’m politically engaged, and this is a particularly interesting election. The Conservative party have been in office … Continue reading Building an…

c#

25 Nov 2023

jonskeet 4 min read

Nearly three years ago, I posted about some fun I’d been having with VISCA using C#. As a reminder, VISCA is a camera control protocol, originally used over dedicated serial ports, but more recently over IP. Until this week, all the cameras I’d worked with were very similar – PTZOptics, Minrray and ZowieTek all produce … Continue reading Variations in…

c#

16 Apr 2022

jonskeet 17 min read

I’ve been keeping an eye on MAUI – the .NET Multi-platform App UI – for a while, but I’ve only recently actually given it a try. MAUI is essentially the evolution of Xamarin.Forms, embracing WinUI 3 and expanding from a mobile focus to desktop apps as well. It’s still in preview at the time of … Continue reading Taking .NET…

c#

27 Mar 2022

jonskeet 23 min read

In part 1, we ended up with a lot of test data specified in a text file, but without working tests – and with a conundrum as to how we’d test the .NET Core 3.1 data which requires additional information about the “hidden” AdjustmentRule.BaseUtcOffsetDelta property. As with the previous blog post, this one is fairly … Continue reading What’s up…

c#noda time

20 Feb 2022

jonskeet 8 min read

As part of my church A/V system (At Your Service), I run a separate local web server to interact with the Zoom SDK. Initially this was because the Zoom SDK would only run in 32-bit processes and I needed a 64-bit process to handle the memory requirements for the rest of the app. However, it’s … Continue reading Diagnosing an…

c#diagnostics

jonskeet 4 min read

In the course of my work on our local church A/V system, I’ve spent quite a lot of time playing with Elgato Stream Decks and NDI cameras. It only occurred to me a week or so ago that it would be fun to combine them. The Stream Deck screens are remarkably capable – they’re 96×96 … Continue reading Displaying NDI…

c#wacky ideas

17 Feb 2022

jonskeet 8 min read

As I have mentioned before, I’ve been spending a lot of time over the last two years writing code for my local church’s A/V system. (Indeed, I’ve been giving quite a few user group talks recently about the fun I’ve had doing so.) That new A/V system is called “At Your Service”, or AYS for … Continue reading Diagnosing a…

c#diagnostics

5 Feb 2022

jonskeet 33 min read

.NET 6 was released in November 2021, and includes two new types which are of interest to date/time folks: DateOnly and TimeOnly. (Please don’t add comments saying you don’t like the names.) We want to support these types in Noda Time, with conversions between DateOnly and LocalDate, and TimeOnly and LocalTime. To do so, we’ll … Continue reading What’s up…

c#noda time

28 Mar 2021

jonskeet 11 min read

Background As I wrote in my earlier blog post about using OSC to control a Behringer XR16, I’m working on code to make our A/V system at church much easier to work with. From an audio side, I’ve effectively accomplished two goals already: Remove the intimidating hardware mixer with about 150 physical knobs/buttons Allow software … Continue reading Playing with…

c#

27 Jan 2021

jonskeet 5 min read

In some senses, this is a follow on from my post on VISCA camera control in C#. It’s about another piece of hardware I’ve bought for my local church, and which I want to control via software. This time, it’s an audio mixer. Audio mixers: from hardware controls to software controls The audio mixer we’ve … Continue reading OSC mixer…

c#

4 Dec 2020

jonskeet 3 min read

During lockdown, I’ve been doing quite a lot of tech work for my local church… mostly acting in a sort of “producer” role for our Zoom services, but also working out how we can enable “hybrid” services when some of us are back in our church buildings, with others still at home. (This is partly … Continue reading VISCA camera…

c#

23 Oct 2020

jonskeet 26 min read

Note: all the code in this blog post is available in my DemoCode GitHub repo, under Functions. For most of 2020, one of the projects I’ve been working on is the .NET Functions Framework. This is the .NET implementation of the Functions Framework Contract… but more importantly to most readers, it’s “the way to run … Continue reading A Tour…

c#

29 Aug 2020

jonskeet 9 min read

History I started blogging back in 2005, shortly before attending the only MVP summit I’ve managed to go to. I hosted the blog on msmvps.com, back when that was a thing. In 2014 I migrated to wordpress.com, in the hope that this would make everything nice and simple: it’s a managed service, dedicated to blogging, … Continue reading Posting to…

c#general

19 Jul 2020

jonskeet 8 min read

This is a blog post rather than a bug report, partly because I really don’t know what’s at fault. Others with more knowledge of how the console works in .NET Core, or exactly what the Travis log does, might be able to dig deeper. TL;DR: If you’re running jobs using .NET Core 3.1 on Travis … Continue reading Travis logs…

c#diagnosticsgeneral

10 Mar 2020

ericlippert 2 min read

Here’s an interesting question I saw on StackOverflow recently; it was interesting because the answer seems obvious at first, but making a small change to the question makes the answer very different. The original question was: suppose we have an … Continue reading →

asynchronyc#

21 Feb 2020

jonskeet 2 min read

It’s amazing how sometimes small changes can make you very happy. This week I was looking at how DragonFruit does its entry point magic, and realized I had a great use case for the same kind of thing. Some of my oldest code that’s still in regular use is ApplicationChooser – a simple tool for … Continue reading New and…

c#speaking engagements

30 Jun 2019

jonskeet 16 min read

This is a blog post I’ve intended to write for a very long time. (Other blog posts in that category include a recipe for tiramisu ice cream, and “knights and allies”.) It’s one of those things that’s grown in my mind over time, becoming harder and harder to start. However, there have been three recent … Continue reading Versioning limitations…

c#designversioning

25 May 2019

jonskeet 3 min read

This morning I tweeted this: Just found a C# 8 nullable reference types warning in Noda Time. Fixing it by changing Foo(x, x?.Bar) to Foo(x, x?.Bar!) which looks really dodgy… anyone want to guess why it’s okay? This attracted more interest than I expected, so I thought I’d blog about it. First let’s unpack what … Continue reading Lying to…

c#c# 8evil code

10 Feb 2019

jonskeet 7 min read

Background: Noda Time and C# 8 Note: this blog post was written based on experimentation with Visual Studio 2019 preview 2.2. It’s possible that some of the details here will change over time. C# 8 is nearly here. At least, it’s close enough to being “here” that there are preview builds of Visual Studio 2019 … Continue reading NullableAttribute and…

c#c# 8noda time

13 Apr 2018

jonskeet 8 min read

I started writing a blog post about versioning in July 2017. I’ve mostly abandoned it, because I think the topic is too vast for a single post. It potentially needs a whole site/wiki/repository devoted to it. I hope to come back to it at some point, because I believe this is a hugely important topic … Continue reading Backward compatibility…

c#evil code

2 Mar 2018

jonskeet 5 min read

Background There are three things you need to know to start with: Operations on read-only variables which are value types copy the variable value first. I’ve written about this before on this blog. C# 7.2 addresses this by introducing the readonly modifier for structs. See the language proposal for more details. I was touched to … Continue reading Implementing IXmlSerializable…

c#c# 7evil codenoda timeperformance

15 Aug 2017

jonskeet 2 min read

This is just a brief post that I’m hoping may help some people migrate to use .NET Core 2.0 SDK on Travis. TL;DR: see the end of the post for a sample configuration. Yesterday (August 15th), .NET Core 2.0 was fully released. Wonderfully, Travis already supports it. You just need dotnet: 2.0.0 in your YAML … Continue reading Using .NET…

c#noda time

26 Apr 2017

jonskeet 2 min read

This is a brief post documenting a very weird thing I partly came up with on Stack Overflow today. The context is this question. But to skip to the shock, we end up with code like this: That just shouldn’t happen. You shouldn’t be able to create an instance of an open type – a … Continue reading Surprise! Creating…

c#evil codestack overflow

9 Jun 2016

jonskeet 8 min read

I’ve been following the progress of .NET Core with a lot of interest, and trying to make the Noda Time master branch keep up with it. The aim is that when Noda Time 2.0 eventually ships (apologies for the delays…) it will be compatible with .NET Core from the start. (I’d expected to be able … Continue reading Tracking down…

benchmarkingc#diagnosticsgeneralperformance

28 Mar 2016

jonskeet 5 min read

Obviously I’d normally ask developer questions on Stack Overflow but in this case, it feels like the answers may be at least somewhat opinion-based. If it turns out that it’s sufficiently straightforward that a Stack Overflow question and answer would be useful, I can always repost it there later. The Facts Noda Time 1.x exists … Continue reading Versioning conundrum…

c#noda time

26 Mar 2016

jonskeet 10 min read

Source code for everything is on Github. It probably won’t be useful to you unless you’ve got very similar hardware to mine, but you may want to just have a look. Background Near the end of 2015, we had a new shed built at the back of our garden. The term “shed” is downplaying it … Continue reading Ultimate Man…

c#wacky ideas

8 Jan 2016

jonskeet 2 min read

Today I’ve been reviewing the ECMA-334 C# specification, and in particular the section about class instance constructors. I was struck by this piece in a clause about default constructors: If a class contains no instance constructor declarations, a default instance constructor is automatically provided. That default constructor simply invokes the parameterless constructor of the direct … Continue reading To base()…

c#evil code

27 Jul 2015

jonskeet 4 min read

First note: this blog post is very much tongue in cheek. I’m not actually planning on using the idea. But it was too fun not to share. As anyone following my activity on GitHub may be aware, I’ve been quite a lot of work on Protocol Buffers recently – in particular, a mostly-new port for … Continue reading “Sideways overriding”…

c#evil code

3 Jun 2015

jonskeet 7 min read

At the moment, I’m spending a fair amount of time thinking about a new version of the C# API and codegen for Protocol Buffers, as well as other APIs for interacting with Google services. While that’s the context for this post, I want to make it very clear that this is still a personal post, … Continue reading Backwards compatibility…

c#evil code

21 Apr 2015

jonskeet 4 min read

As I’ve mentioned before, I’m part of the technical group looking at updating the ECMA-334 C# standard to reflect the C# 5 Microsoft specification. I recently made a suggestion that I thought would be uncontroversial, but which caused some discussion – and prompted this “request for comment” post, effectively. What does the standard say about … Continue reading Precedence: ordering…

c#

1 Dec 2014

jonskeet 8 min read

Here’s a few things you may not be aware of: C# identifiers can include Unicode escape sequences (\u1234 etc) C# identifiers can include Unicode characters in the category “Other, formatting” (Cf) but these are ignored when comparing identifiers for equality The Mongolian Vowel Separator (U+180E) has oscillated between the Cf and Zs categories a couple … Continue reading When is…

c#evil code

7 Nov 2014

jonskeet 7 min read

When is a string not a string? As part of my “work” on the ECMA-334 TC49-TG2 technical group, standardizing C# 5 (which will probably be completed long after C# 6 is out… but it’s a start!) I’ve had the pleasure of being exposed to some of the interesting ways in which Vladimir Reshetnikov has tortured … Continue reading When is…

c#evil code

6 Nov 2014

jonskeet 3 min read

This post has a few purposes – it’s partly a bit of advertising, but it’s also meant to serve as a quick way of replying to speaking requests for a while… if you’ve been directed here by an email from me, I hope you’ll excuse the “form letter” approach. (You can probably skip down to … Continue reading Writing and…

booksc#speaking engagements

23 Oct 2014

jonskeet 7 min read

For a while now, I’ve been a big fan of a pattern in C# which mimics Java enums to a certain extent. In general, it’s a lovely pattern. Only after reading a comment on a recent blog post by Eric Lippert did I find out about a horrible flaw. Dubious thanks to John Payson for … Continue reading Violating the…

c#evil code

22 Aug 2014

jonskeet 9 min read

A comment on a Stack Overflow post recently got me delving into constants a bit more thoroughly than I have done before. Const fields I’ve been aware for a while that although you can specify decimal field as a const in C#, it’s not really const as far as the CLR is concerned. Let’s consider … Continue reading When is…

c#evil codecsharpevilcode

8 Aug 2014

jonskeet 3 min read

I started writing a post like this a long time ago, but somehow never finished it. Countless posts on Stack Overflow are vulnerable to SQL injection attacks. Along with several other users, I always raise this when it shows up – this is something that really just shouldn’t happen these days. It’s a well-understood issue,and … Continue reading The BobbyTables…

c#evil codestack overflow

16 Jul 2014

jonskeet 7 min read

Introduction Recently I’ve been optimizing the heck out of Noda Time. Most of the time this has been a case of the normal measurement, find bottlenecks, carefully analyse them, lather, rinse, repeat. Yesterday I had a hunch about a particular cost, and decided to experiment… leading to a surprising optimization. Noda Time’s core types are … Continue reading Micro-optimization: the…

c#evil codeperformance

16 May 2014

jonskeet 7 min read

I’ve always found Portable Class Library (PCL) configuration to be a bit of a mystery. In simple cases, it’s simple: start a new PCL project in Visual Studio, select the environments you want to support, and away you go. But what’s going on under the hood, and what do all the options mean? How do … Continue reading Diagnosing Portable…

c#diagnostics

8 Apr 2014

jonskeet 3 min read

This post is the answer to yesterday’s brainteaser. As a reminder, I was asking what purpose this code might have: public static class Extensions { public static void Add<T>(this ICollection<T> source, T item) { source.Add(item); } } There are plenty of answers, varying from completely incorrect (sorry!) to pretty much spot on. As many people … Continue reading Extension methods,…

c#c# 6evil code

7 Apr 2014

jonskeet 1 min read

Just a really quick one today… What’s the point of this code? Does it have any point at all? public static class Extensions { public static void Add<T>(this ICollection<T> source, T item) { source.Add(item); } } Bonus marks if you can work out what made me think about it. I suggest you ROT-13 answers to … Continue reading Quick brainteaser…

c#evil code

14 Jan 2014

jonskeet 10 min read

As I begin to write this, I’m in a small cubicle in Philadelphia airport, on my way back from CodeMash – a wonderful conference (yet again) which I feel privileged to have attended. Personal top highlights definitely include Dustin Campbell’s talk on C# 6 (I’m practically dribbling with anticipation – bits please!) and playing Settlers … Continue reading A tale…

c#

19 Sept 2013

jonskeet 9 min read

Note: this blog post has now been turned into a video by Webucator, to go alongside their C# classes. (I’ve ended up commenting on this issue on Stack Overflow quite a few times, so I figured it would be worth writing a blog post to refer to in the future.) There are lots of ways … Continue reading Casting vs…

c#design

7 Sept 2013

Dave Cheney 4 min read

It looks like Go 1.4 will remove support for Go packages containing C code (as described below, don’t confuse this with CGO), so enjoy it while it lasts. This is a short post designed to illustrate how Go package authors can write package level functions in C and call them from Go code without using […]

goprogrammingc++cgo

22 Jun 2013

jonskeet 5 min read

It seems to be quite a long time since I’ve written a genuine "code" blog post. Time to fix that. This material may well be covered elsewhere – it’s certainly not terrifically original, and I’ve been meaning to post about it for a long time. In particular, I remember mentioning it at CodeMash in 2012. … Continue reading Array covariance:…

benchmarkingc#designwacky ideas

18 Apr 2013

jonskeet 1 min read

A little while ago I was contacted about a new merge tool from the company behind PlasticSCM. (I haven’t used Plastic myself, but I’d heard of it.) My initial reaction was that I wasn’t interested in anything which required me to learn yet another source control system, but SemanticMerge is independent of PlasticSCM. My interested … Continue reading New tool…

c#general

14 Feb 2012

Schakko 2 min read

Aus äh… historischen Gründen ist es so, dass eines unserer C#-Projekte sowohl NUnit als auch xUnit für die Unittests nutzt. Über Sinn und Zweck dieser Konfiguration brauchen wir nicht zu diskutieren – Fakt ist, dass sich das nicht auf die Schnelle ändern lässt. Ich wollte nun dieses Projekt in TeamCity […] The post Fehlerhafte Unittests in NUnit und xUnit von…

c#nunitteamcityxunit

13 Oct 2010

Schakko 2 min read

Die letzten beiden Tage war ich damit beschäftigt, ein paar Evaluierungen für die .NET-Plattform zu machen. Eines unserer Projekte greift mit Hilfe eines (zugegebenermaßen ziemlich coolen) WPF-Frontends über WCF auf einen SOAP-Service zu, der die Verbindung zu einer MS SQL-Datenbank herstellt. Logging auf die Konsole Unter Java bzw. innerhalb eines […] The post .NET aus der Sicht eines Java-Entwicklers appeared…

application serverc#javamicrosoft.net