Category Archives: .NET

Microsoft .NET issues and solutions

Invariant string interpolation

I’m sure you like C# string interpolation support ($”{…}”): var start = DateTime.Now; var end = start.AddDays(7); string weekIntervalText = $”{start}-{end}”; But you also know that this uses the current thread’s culture to format the string, so you think “Oh, … Continue reading

Posted in C# | Tagged , , , , | Leave a comment

Attached properties and the WPF DataGrid

WPF attached properties. They look like such a difficult topic. But you only need to see a single example in action to understand their true potential: as long as your objects inherit from DependencyObject you can add as many extra … Continue reading

Posted in WPF | Tagged , , , , | Leave a comment

Swagger error 500 when you have a Get without arguments in ASP .NET Core

In an ASP .NET Core project where Swagger was configured using Swashbuckle.AspNetCore package to automatically expose endpoint documentation, I had seen this strange behavior regarding HttpGet methods in controller classes: With a Get method that required an argument, Swagger UI (documentation) … Continue reading

Posted in ASP .NET | Tagged , , , , , | Leave a comment

When optionals are… required

Assume you have developed a service, with methods requiring arguments, properly extracted into a interface. Then you (or your customers) would write nice clients for your service. Of course, such clients will probably be unit tested in isolation, such as … Continue reading

Posted in C# | Tagged , , , | Leave a comment

DataGridComboBoxColumn.ItemsSource binding issue

The code below doesn’t work as one would expect, i.e. to allow selecting one value for each item in the DataGrid using ComboBoxes in a secondary column, even if if there is an AvailableValues property in the Window container class … Continue reading

Posted in WPF | Tagged , , , | Leave a comment

XAML element properties and cut-paste refactoring

As you know, to set properties for WPF objects in XAML, one uses either attributes or elements, like the Text and LayoutTransform properties of the TextBox element below, respectively: <Border> <TextBlock Text=”Hello!”> <TextBlock.LayoutTransform> <ScaleTransform ScaleY=”2″/> </TextBlock.LayoutTransform> </TextBlock> </Border> Using elements is required when … Continue reading

Posted in WPF | Tagged , , , , , , | Leave a comment

Bloody space in a form input name

Suppose that you have to HTTP-post a form with some pre-computed hash field to a service. You prepare the form as HTML or as an HTTP client call, with a hidden input field or a request body parameter that is … Continue reading

Posted in HTML5, WebAPI | Tagged , , , , , , | Leave a comment