Archiv der Kategorie: General

Visual Studio Extensions: SlowCheetah to transform XML and JSON Configuration Files

I have been using this Extension at some occasions, and it’s good to see, that it’s still around.

You might have noticed, that you can add transformations for your Web.config file based on the Build Configurations you are using. By default, transformations for Release and Debug are added automatically. If you have added your own Configuration, you can add transformations for these too.







This will create a transformation file, to modify the original Web.Config. You can replace Connections Strings, Servernames, Pathsettings – Basically everything, based on the Original Web.Config you have created.

However, if you try to do this for example for App.config in a Console Application, you will notice that there is no such option. Not even transformations are added for the default Build Configurations.

This is, where SlowCheetah comes in handy. You can install it via Extension Manager, and after restarting Visual Studio, it will be available.

After Installation is complete, we can have a look at out previous Console Application again and Right-Click on the App.Config file. Et voila, now we have an Option called „Add Transform“.

When executing this command, it will ask you to install the SlowCheetah Nuget package. This is required to run transformations, even if the Extension itself is not installed. So, not every member of your team needs to install the extension, only the people modifying the Configuration need it. But it will work for all team-members by using the installed Nuget package.

After we have done this, SlowCheetah creates the transformations for the default Configurations. If we add special configurations later, we just have to run the „Add Transform“ again, to have new transformations added.

You can also find SlowCheetah in the Visual Studio Market Place

The Sourcecode can be found on GitHub: https://github.com/Microsoft/slow-cheetah

Champions of C# 9 : „Simplified parameter null validation code“

In this blog post I wan’t to have a closer look at a current proposals for the upcoming C# Version 9.

Proposal #2145 – Simplified parameter null validation code.

Usually, if handing over parameters to a method, some checking for NULL is required to prevent unexpected behavior. Have a look at the following sample of a method with some checking.

In C# 9, this code could be simplified by adding ! as an indicator for „Will not be NULL“ to the parametername. The code would then look like this.

Based on This discussion from summer 2019, the new syntax is supposed to throw an Exception too, if the constraint is violated. Most likely also an ArgumentException, but this doesn’t seem to have specified yet.


New Resources Section and first Page „Resources to learn C# and ASP.NET“

Today I published a new section in my Blog, to collect resources to various topics. The goal for these pages is, to stick around and for me to update them regularly, to keep them relevant. The first page of this format is about Learning C# and ASP.NET. As someone who is working with these technologies for almost two decades, I hope I can deliver some useful information for beginners. Also, I am open for suggestions. What resources did I forget ? Let me know.
Sascha

Sundays IT: Ever wondered, why chrome runs so many processes ?

Hi everyone,

did you ever ask yourself, why the hack is chrome running so many processes ?

Image of Windows Taskmanager

This image shows only 5 processes, but this can go up to an nearly insane amount.
According to some articles I read, chrome encapsulates every single page into its own process, to prevent crashing the browser when one page goes down.

Chrome provides a way, to get an overview of the processes it runs. To see it, go to you menu => more tools => Taskmanager

Image of Chrome Taskmanager Menu

Image of Chrome Taskmanager

And here you see the different processes Chrome is using. There is one for the browser itself, some additionals for certain features (In this case GPU) and one process for every page you have open at the moment.

Have a nice sunday
Sascha

Sundays IT: Windows Update on my Win7 machine is stuck at 0% again – 4 Steps solution

Hi everyone,

its annoying when Windows Updates just is not working and its download percentage is Stuck at 0%. I like to share my process to solve this issue – So I do the following:

  1. Opening a command prompt with elevated permissions by typing cmd in my searchbox, right-click and select „run as aministrator“ or just type cmd into the box and hit CTRL+Shift+Enter.
  2. Stopping the update service by typing net stop wuauserv into the command prompt and hit enter.
  3. Deleting the contents of C:\Windows\SoftwareDistribution using the windows explorer.
  4. Starting the update service by typing net start wuauserv into the command prompt and hit enter.

After that, I need to scan for new updates again (May take a while, since the cached information is gone). Downloading them should now work as expected.

DISCLAIMER: Reproduce at your own risk and without warranties.

Have a nice sunday
Sascha