Highlights from Microsoft Build 2020

The Microsoft Build 2020 event happened this week, and, unlike all previous editions, it was a digital event only. Moreover, it was also free, so everybody could attend the 48 hours marathon. Microsoft made a lot of announcements and released various products and services for Windows, Azure, Office, Visual Studio, Edge, and more. In this post, I will summarize the things that I found the most interesting for me.

My book “Learn C# Programming” has been published

I am pleased to announce that my new book, Learn C# Programming, that I co-authored together with Raffaele Rialdi (Microsoft MVP/speaker) and Ankit Sharma (C# Corner MVP/Google Dev Expert/speaker) has been published at PacktPub. The book can be ordered at PacktPub and Amazon (ISBN 9781789805864).

This book is primarily intended for people that want to learn to program in C# for .NET. This book will not teach you the basics of programming but it will teach you the C# language from the very basics to the most advanced topics, and to the latest in C# 8, which is the current version of the language. However, if you are an experienced C# programmer, but want to learn the latest features from C# 8 or how to work with .NET Core, target multiple platforms, and migrate from .NET Framework, this book should be handy for you too.

Data-driven unit tests for managed code

The Microsoft unit testing code for managed code allows to create test methods that are executed with data automatically fetched from an external data source. This is very helpful because we can extend the data sets without modifying the test code. An external data source can be an SQL database, a CSV file or Excel document, an XML document, or anything else for which a provider for .NET exists. In this article, I will show how you can define test data using all these types of source and execute unit testing methods with it.

This feature is available only for .NET Framework.
At this time, data-driven unit testing from a data source is not supported for .NET Core.

Enabling TLS 1.2 in your .NET framework applications

A functionality of one of the products I’m working on suddenly stopped working without any code changes on our side. Our application connects to a web service to get some data and that no longer worked, our customers getting the following error in their logs “The underlying connection was closed: An unexpected error occurred on a send.” The first thing to do was checking whether the web service was still up and running as expected. The requests made with SoapUI or Postman were all successful, so it was actually something in our application that was actually wrong. So I decided to use Fiddler to look at how our requests look and what do we get back.

Inline out variables and ref locals and returns in C# 7

In C#, function parameters can be declared with the ref or out modifier, the former indicating that a value is already set and the function can read and write it, and the later that the value is not set and the function must do so before returning. As a side note, there is a good…

CategoriesC#

TDD with Live Unit Testing in Visual Studio 2017

Visual Studio 2017 Enterprise provides a feature called Live Unit Testing that enables developers to see live how changing C# and VB.NET code affects its corresponding unit tests. Among its features, it includes showing coverage information in the editor as you type, integration with the Test Explorer, including/excluding targeted test methods or projects for large…

C# Interactive Window in Visual Studio 2015 Update 1

The C# Interactive window has been made available again in Visual Studio with the first update to 2015, this time as a REPL window. You can type or paste and execute C# code, and it includes support for adding references to external DLLs and using namespaces. The window is intended for rapid prototyping C# code….

Working with the Settings Charm for Windows 8.1 Store Applications

Windows 8 features a Settings charm to display both application (the top part) and system (the bottom part) settings (you get it from swiping from the side of the screen). The system provides two entry points, Permissions and Rate and Review, the later only for applications installed through the store. You can customize the settings…

Render the screen of a Windows Store App to a bitmap in Windows 8.1

In WPF, Silverlight and Windows Phone it is possible to render a visual object into a bitmap using the RenderTargetBitmap. This functionality, that I find pretty basic, was not available for Windows Store applications. Fortunately, Windows 8.1 provides that functionality for Windows Store applications too, through the same RenderTargetBitmap class. There are some limitations though:…