.net core 3 yields different floating point results from version 2.2

.NET Core introduced a lot of floating point parsing and formatting improvements in IEEE floating point compliance. One of them is IEEE 754-2008 formatting compliance. Before .NET Core 3.0, ToString() internally limited precision to “just” 15 places, producing string that couldn’t be parsed back to the original. The question’s values differ by a single bit. … Read more

JsonSerializer.Deserialize fails

Your problem is that System.Text.Json is case-sensitive by default, so “id”: 9 (all lowercase) is not mapped to the Id property. From the docs: Case-insensitive property matching By default, deserialization looks for case-sensitive property name matches between JSON and the target object properties. To change that behavior, set JsonSerializerOptions.PropertyNameCaseInsensitive to true: Note: The web default … Read more

Why File.ReadAllLinesAsync() blocks the UI thread?

Sadly currently (.NET 5) the built-in asynchronous APIs for accessing the filesystem are not implemented consistently according to Microsoft’s own recommendations about how asynchronous methods are expected to behave. An asynchronous method that is based on TAP can do a small amount of work synchronously, such as validating arguments and initiating the asynchronous operation, before … Read more