C# 7 Series, Part 6: Read-only structs

C# 7 Series Part 1: Value TuplesPart 2: Async MainPart 3: Default LiteralsPart 4: DiscardsPart 5: Private ProtectedPart 6: (This article) Read-only structs Background In .NET world, there are two basic types: reference types and value types. To be short, Reference types are classes that can be inherited/extended, when passing reference type objects, a “pointer”…


Overview of Visual Studio 2017 and Updates for .NET Developers

Visual Studio 2017 first released in March of this year. Since then, there have been five updates with each bringing more improvements and capabilities. Every improvement is geared towards making you more productive and this post aims to give you an overview of the culmination of features to date. Read on to see how you…


Improving the debugging experience for std::function

fWe received a Visual Studio User Voice suggestion to make “StepInto” go directly to user code, skipping past standard library (std::function) implementation details. We recently worked on this suggestion and implemented it in the last version of Visual C++. The issue: Single-stepping through a call to an instance of std::function was a particular pain point….

21

Introducing Nullable Reference Types in C#

Today we released a prototype of a C# feature called “nullable reference types”, which is intended to help you find and fix most of your null-related bugs before they blow up at runtime. We would love for you to install the prototype and try it out on your code! (Or maybe a copy of it!…


Welcome to C# 7.2 and Span

C# 7.2 is the latest point release of C#, and adds a number of small but useful features. All the features are described in wonderful detail in the docs. Start with the overview, What’s new in C# 7.2, which gives you an excellent introduction to the new set of capabilities. It is worth celebrating that…


Azure Functions and Azure are blowing my mind

I am really starting to like these Azure Functions.  Just imagining that I don’t even need a server anymore…at all.  Only a few years ago the major blocker was getting a server online to manage requests from your customer, the cost, complexity and management was HUGE!  And now you don’t even need one at all. …


Query LDAP

Here is an example of how to query a secure LDAP service while using a certificate for authentication.  This example utilizes a previous blog for importing the certificate:  https://blogs.msdn.microsoft.com/metaverse/2017/11/09/capturing-a-pki-certificate/ char[] commaExcape = new char[] { ‘,’ }; char quotestring = ‘”‘; string accountName = “JDUser”; string url = “server.fqdn:636”; string attrs = “uid,givenname,cn,ou”; string[] attrset…


Quering JSON with Certificate

I recently had a requirement to query an application that requires certificate authentication and replies with JSON.  This example utilizes a previous blog for importing the certificate:  https://blogs.msdn.microsoft.com/metaverse/2017/11/09/capturing-a-pki-certificate/ X509SecurityToken certtoken = GetSecurityToken(“a1b2c3”); X509Certificate2 cert = new X509Certificate2(certtoken.Certificate); string accountName = “JDUser”; string url = “https://server.fqdn/rest/” + accountName; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; HttpWebRequest request = WebRequest.Create(url) as…


Capturing a PKI Certificate

I found it was easiest to use a certificate token when accessing systems using a certificate.  This is the method I use to accomplish the task querying based on the certificate thumbprint (the thumbprint ensures that I get correct certificate): public X509SecurityToken GetSecurityToken(string certThumb) { X509SecurityToken securityToken = null; X509Store store = new X509Store(StoreName.My, StoreLocation.LocalMachine);…


CMake Support in Visual Studio – Import Your CMake Cache

Configuring a CMake project to build in just the way you want can often be a time intensive process, so in Visual Studio 2017 15.5 preview we have made it easier than ever to import your existing CMake projects and cache configurations into the IDE.  You can now import an existing CMakeCache.txt file and Visual…