Category Archives: .NET

Microsoft .NET issues and solutions

ToolTipService.ShowDuration within a specific WPF view

ToolTipService.ShowDuration attached property isn’t inherited from parent to child elements within the WPF visual tree, and therefore values for this property – to produce runtime effects – must be set on all the elements that have ToolTips for which we’d … Continue reading

Posted in WPF | Tagged , , ,

Mocking “this”

Let’s assume we have a simple service that is also using an inner service, providing a few operations as follows: public interface IService {     string A();     string B();     string C(); } public class Service : IService {     private readonly IInnerService innerService;     public Service(IInnerService innerService)     {         this.innerService = innerService;     }     public string A()     {         return “A”;     }     public string B()     {         return b(); … Continue reading

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

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