Feed jon-skeets-coding-blog Jon Skeet's coding blog

Favorite IconJon Skeet's coding blog

Link https://codeblog.jonskeet.uk/
Feed http://codeblog.jonskeet.uk/feed/
Updated 2024-11-21 16:32
Diagnosing a single slow test
In the last blog post, I investigated why my Noda Time tests on Travis were running much slower than those on AppVeyor. I resolved a lot of the problem just by making sure I was running release builds on Travis. That left a single test which takes up about half of the test time though: … Continue reading Diagnosing a single slow test →
Diagnosing slow tests (again)
I’ve previously blogged about a case where tests on .NET Core on Linux were much, much slower than the same tests on Windows. Today I’ve got a very similar problem – but I suspect the cause isn’t going to be the same. This is my reasonably raw log – skip to the end for a … Continue reading Diagnosing slow tests (again) →
Diagnostics everywhere!
For a long time, I’ve believed that diagnostic skills are incredibly important for software engineers, and often poorly understood. The main evidence I see of poor diagnostic skills is on Stack Overflow: “I have a program that does 10 things, and the output isn’t right. Please fix.” “I can’t post a short but complete program, … Continue reading Diagnostics everywhere! →
Using .NET Core 2.0 SDK on Travis
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 Core 2.0 SDK on Travis →
Upcoming speaking engagements
I’ve got a few speaking engagements coming up that I thought it might be worth publicising a bit further. They’re all within just over a week of each other, which is going to be somewhat tiring, but… Here they are, in chronological order: Progressive .NET 2017 Progressive .NET 2017 will be held on September 13th-15th … Continue reading Upcoming speaking engagements →
Imposter Syndrome (part 2)
9 days ago, I posted Imposter Syndrome (part 1) and then immediately listened to Heather Downing‘s excellent NDC talk on the topic. This is the “reflections afterwards” post I’d expected to write (although slightly more delayed than I’d hoped for). I’m not going to try to recap Heather’s talk, because that wouldn’t do justice to … Continue reading Imposter Syndrome (part 2) →
Imposter syndrome (part 1)
Note: this is a purely personal post. It has no code in. It’s related to the coding side of my world more than the rest of who I am, so it’s in my coding blog, but if you’re looking for code, just move on. As part of a Twitter exchange, I discovered that Heather Downing … Continue reading Imposter syndrome (part 1) →
Surprise! Creating an instance of an open generic type
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 an instance of an open generic type →
All about java.util.Date
This post is an attempt to reduce the number of times I need to explain things in Stack Overflow comments. You may well be reading it via a link from Stack Overflow – I intend to refer to this post frequently in comments. Note that this post is mostly not about text handling – see … Continue reading All about java.util.Date →
Diversity and speaking engagements
Background I’m in the privileged position of receiving more invitations to speak (at conferences, user groups and podcasts) than I can realistically agree to. I’ve decided to start applying some new criteria to how I pick which ones I go to1. However, over the last couple of years as feminism has become an increasingly important … Continue reading Diversity and speaking engagements →
Thoughts on privilege (moved!)
This was accidentally first posted here on my Code Blog. I deleted it and subsequently posted it in the proper place on my non-code blog. I’ve restored this placeholder post just so that anyone following links to it won’t get a 404…
Tracking down a performance hit
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 a performance hit →
Versioning conundrum for Noda Time – help requested
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 for Noda Time – help requested →
Ultimate Man Cave: voice automation for my shed
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 Cave: voice automation for my shed →
To base() or not to base(), that is the question
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() or not to base(), that is the question →
“Sideways overriding” with partial methods
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” with partial methods →
Backwards compatibility is (still) hard
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 is (still) hard →
Common mistakes in date/time formatting and parsing
There are many, many questions on Stack Overflow about both parsing and formatting date/time values. (I use the term “date/time” to mean pretty much “any type of chronlogical information” – dates, times of day, instants in time etc.) Given how often the same kinds of mistakes are made, I thought it would be handy to … Continue reading Common mistakes in date/time formatting and parsing →
Precedence: ordering or grouping?
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 or grouping? →
Backward compatibility pain
I’ve been getting a bit cross about backward compatibility recently. This post contains two examples of backward incompatibilities in .NET 4.6, and one example of broken code which isn’t being fixed due for backward compatibility reasons. Let me start off by saying this post is not meant to be seen as an attack on Microsoft. … Continue reading Backward compatibility pain →
Clean event handler invocation with C# 6
The problem Invoking event handlers in C# has always been a bit of a pain, because an event with no subscribers is usually represented as a null reference. This leads to code like this: It’s important to use the handler local variable, as if instead you access the field twice, it’s possible that the last … Continue reading Clean event handler invocation with C# 6 →
C# 7 feature request #1… extension attributes
Last week I learned that using static is going to be the syntax for importing static members (including extension methods) in C# 6. That fulfils a feature request I made in September 2005 (my fourth ever blog post, as it happens). With a feature request turnaround of 10 years, I figure I should get put … Continue reading C# 7 feature request #1… extension attributes →
C# 6 in action
Now that the Visual Studio 2015 Preview is available and the C# 6 feature set is a bit more stable, I figured it was time to start updating the Noda Time 2.0 source code to C# 6. The target framework is still .NET 3.5 (although that might change; I gather very few developers are actually … Continue reading C# 6 in action →
When is an identifier not an identifier? (Attack of the Mongolian Vowel Separator)
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 an identifier not an identifier? (Attack of the Mongolian Vowel Separator) →
When is a string not a string?
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 a string not a string? →
Writing and speaking update
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 speaking update →
Violating the “smart enum” pattern in C#
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 “smart enum” pattern in C# →
The mysteries of BCL time zone data
Note: I’ve now identified two bugs in TimeZoneInfo… details later in the post. Background Early on Friday morning (UTC), IANA released version 2014h of the time zone database. As a dutiful Noda Time maintainer, I fetched it, converted it into our native format, and ran the unit tests prior to pushing the new version. Unfortunately, … Continue reading The mysteries of BCL time zone data →
12