Event Viewer Logs with .NET Core Workers as Windows Services

Back in the older classic windows only .NET Framework days, I would use a cool framework called TopShelf to help turn a console application during development into a running windows service in production. Today instead I was able to install and run a windows service by modifying a .NET Core Worker project by just using .NET Core natively. Also, I was able to add some logging to the Windows Event Viewer Application Log. First, I...

Continue Reading

Apply Cut or Copy to blank lines when there is no selection

I mostly code in Visual Studio Code Insiders on either macOS or Linux but on the occasion that I develop on windows, I do like to use the old faithful Visual Studio. And today I fixed a slight annoyance that I have with Visual Studio 2019. If you cut or copy on a blank line accidentally which does happen you will lose your clipboard contents. To fix this in the search bar at the top...

Continue Reading

Timers in .NET Part 2

I have started to cross-post to the Dev Community website as well as on my solrevdev blog. A previous post about Timers in .NET received an interesting reply from Katie Nelson who asked about what do do with Cancellation Tokens. TimerCallBack The System.Threading.Timer class has been in the original .NET Framework almost from the very beginning and the TimerCallback delegate has a method signature that does not handle CancellationTokens nativly. Trial and error So, I...

Continue Reading

Navigate into a newly created directory

Today I came across a fantastic command line trick. Normally when I want to create a directory in the command line it takes multiple commands to start working in that directory. For example: mkdir tempy cd tempy Well, that can be shortened to a one-liner! mkdir tempy && cd $_ 🤯 This is why I love software development. It does not matter how long you have been doing it you are always learning something new!...

Continue Reading

Timers in .NET

A current C# project of mine required a timer where every couple of seconds a method would fire and a potentially fairly long-running process would run. With .NET we have a few built-in options for timers: System.Web.UI.Timer Available in the .NET Framework 4.8 which performs asynchronous or synchronous Web page postbacks at a defined interval and was used back in the older WebForms days. System.Windows.Forms.Timer This timer is optimized for use in Windows Forms applications...

Continue Reading