Always use a culture when comparing strings, just like your mama taught you
We dive deeper into the non-bug bug around String comparison and globalization; and we wait patiently for .NET 5 to drop.
Hey again, what a week. We had a blue moon, Halloween, and Daylight savings time end all one one night.
In case you're the voting type here in these United States, that's happening tomorrow, where the choices are between two old white guys. You would think we would have learned our lesson by now, but we have not.
But this is not last week in politics, this is last week in .NET, so let's get to it.
📅 .NET Conf is November 10th-12th. I'll be livetweeting as much as possible on twitter @gortok, and if somehow your working situation allows you to partake, you should. This is when .NET 5 will be released, and there should be lots of goodies -- especially Blazor.
🐞 Last week I talked about a bug with regards to String.IndexOf Comparisons in .NET 5 and .NET Core 3.1; this turns out to be a major paradigm shift (not an actual 'bug'), and a lot of people (including me) were caught by surprise by it. If you do String.IndexOf comparisons for cross-platform data ingestion (for example, you ingest log files in Windows and log files on *nix based systems and potentially have mixed \r\n (windows newlines) with \n (linux new lines)), you're gonna run into this. There are other situations where you'll run into it as well; but this would be the most common in an ascii context. The non-bug bug here is that the behavior is different on Windows vs. Linux and the behavior itself has changed over the life of .NET Core on Windows; specifically when they decided to stop using NLS and start using ICU on Windows (Linux has always used ICU). There's a github thread with more detail, but bottom line: Be on the lookout for this when you ingest strings from external sources and are using String.IndexOf or String.Contains; and make sure you're using Ordinal Comparisons in these cases. Jimmy Bogard (the person who found this non-bug bug) also released a blog post about it; he breaks down what happens and why. Levi Broderick also opened a new github issue to game-plan the way forward so developers aren't caught by surprise with this change.
🐞 Simon Cropp found an issue on twitter where if you use Process.WaitForExit and the Process.OutputDataReceived events, and running multiple processes, you can get empty or partial output data (from redirected Standard Out (STDOUT)).
This bug is from 2018, but is getting increased attention now that .NET 5 is almost at the finish line. It's not fixed, but here's to being aware of it.
🎁 Have you heard of the Microsoft.dotnet-httprepl package? It's... well.. an HTTP REPL for .NET. It's brought to us by the folks at Microsoft and they had another release last week for 5.0.0-preview.20527.2 . It is in preview, but I'd expect it to be generally available when .NET 5 lands. If you want something like Postman for the command line, give this a try. I can hear the cURL folks screaming now.
🎥 There's an archived video stream that took place on 2 October 2020 that talked about performance improvements in .NET 5. This video clocks in at just under two hours, but if you're a performance wonk, this may be up your alley. Special thanks to Dee Dee Walsh on twitter (@ddskier) for making me aware of this.
🐦 On the subject of Twitter, David Fowler (@davidfowl) released screenshots on how in .NET 5 you can now break down where a network call took the most time in ASP.NET Core. This works for the HttpServer, HttpClient, DNS, and Sockets classes, and is pretty wild.
☠ RIP Flash. There's an update to Windows 10 that permanently removes Adobe Flash. Flash defined rich internet applications at one point in time, and while I'm sad to see it go; it was a relic of yesteryear. Though funny enough nothing has replaced it yet bit for bit. This update is KB4577586, and is 'optional', for now.
📢 The call for speakers for .NET OpenSource days 2020 is open. If you run or maintain an open source project on .NET, you should consider submitting a talk.
📢 .NET Framework October 2020 Cumulative Update Preview Update for Windows 10 version 2004 and Windows Server, version 2004 has been released. This release fixes an issue if you use Kazakh collation in SqlClient, and a regression issue with WPF where two HostVisual elements disconnect at the same time. A crash with WPF has been fixed, this having to do with typing into a textBox. Users tend to type a lot so I'm glad they fixed it.
⚔ In the category of API design ideas, there's a blog post out on a 'new' way to do REST API versioning, and I'll let you read it. I, for one, have been a part of enough holy wars over HTTP and "REST" API Versioning that I'm perfectly happy never getting into another one. Since twitter comments are typically better than blog comments, you can see how everyone else feels about this by checking out the twitter thread
And that's what happened Last Week in .NET. I'm George Stocker, and I'll see you next week.