The art of Debugging

The art of Debugging

I have been debugging software for the last 20 years, and although things have changed, I realize I took it for granted and never really thought about it.


There were two debugging technique if was introduced to when I started.
  1. Attach a debugger to a program and hit breakpoints. When you hit a breakpoint, the debugger can show you your source code because the symbols have a mapping from the assembly code to the source code. At a breakpoint you can inspect variables, change their values. You can control the flow of execution of your program by executing the next instructions and even change what the next instruction is.
  2. This technique is a bit more brute force, but consists of using logging to get insight into code which is hard to debug with breakpoints. Although less efficient than breakpoints, I have done this soooo often because it allows me to debug also in cases like production, where I might not be able use breakpoints.

Step forward a few years and we now have Visual Studio 2017. Both techniques above still work but with a few new features. For example, for logging we don’t have to use the console but have access to Trace and Debug, both with listeners to output where you want. Even better are TraceSources, which are specialized objects for logging for modules. Always making things easier, VS also shows us a few graph about memory and threads.

To complement the advances in the platform, there are a bunch of other logging frameworks such as nlog, log4net, serilog… One of the advance i love about these frameworks are the concept of structured logging, imagine logging with DTOs. While we are on the subject, there are even logging frameworks as a service, all cloud based !
There are dump files that can be created at breakpoints in your code, which are basically a memory snapshot of your process. These can be inspected with WinDBG or Visual Studio
It does feel much more modern but all that we have seen is fundamentally the same thing. Things are getting much better…

Modern Debugging

One of the bigger breakthroughs in debugging we got a few years ago was called edit and continue. You can literally change code of running programs as they run… Quite interesting although I cant say have used this mechanism often. This requires Visual Studio.
The second one which has served me well is IntelliTrace. This is basically a configuration based approach to automatic logging – as the debugger hits different places (breakpoints) in the code, events are generated with some contextual information. For example – File.Delete() will generate an IntelliTrace event with the text “File asdf.txt deleted”. This is great as all major components of dot net are instrumented with this technology. IntelliTrace requires Visual Studio but using the offline IntelliTraceCollector, you can record the execution of your code and analysis everything in Visual Studio.
The newest feature which is currently in preview is called Time Travel Debugging, which basically allows your to execute your code… in reverse. You can go forward into your code’s execution as well as backwards, just look at the ribbon in WinDBG Preview (available in the Windows Store).

I haven’t had the chance to play with this too much, but it looks very fun, as it will allow you to go back in time in a break point within a loop… The recorded traces have to be viewed with WinDBG.

Another new feature which i think i will love is the concept of snappoints and logpoints. Imagine the ability to attach to a running process, but instead of pausing the process when you hit a breakpoint, a myriad of information gets recorded when a snappoint is passed. You could then inspect the variables and stack trace of every one of those hits without causing impact. Logpoints are dynamic logging, pass this instruction and add this event to the log. These are great advancements to the art of debugging. This feature requires Visual Studio and Azure hosted sites.

I hope you are excited about the future of debugging !

Sharing an IDE

Well, it’s happening…

I just saw this channel9 video on how to share a code writing, debugging session with someone else… It’s also the first feature i know of which works with VS Code and Visual at the same time.

Enjoy !


The Microsoft Graph

One of the project i was working on involves taking Office 365 to the next level. Take the tools that Microsoft gives us and bring it to the next level.

Some of the things we do involves extending Sharepoint, Excel, Word, Office with addons. Works great. But where do we get all the nice information we show the user ?

This is where the Microsoft Graph comes in ( It is basically an odata feed that gives you access to a variety of data that represents you. Naturally, you need to send a bearer token to get access so authenticate first !

You can find then entire “metadata” on the internet itself, all self-describing ! Also, there is some documentation.

You can even try the Graph Explorer, which is a web tool to explore the graph in an interactive way.

Here a are a few example of me for my own company :

Who am i ?

 "@odata.context": "$metadata#users/$entity",
 "id": "",
 "businessPhones": [],
 "displayName": "Erik Renaud",
 "givenName": "Erik",
 "jobTitle": "Principal Architect",
 "mail": "",
 "mobilePhone": "+1 514...",
 "officeLocation": "+1.514...",
 "preferredLanguage": "en-CA",
 "surname": "Renaud",
 "userPrincipalName": ""

What about my picture ?



This is a goldmine of information and makes any business tool soo much more powerful.

Add  an email, find recently used files, show how many unread things in teams… It’s all possible !



Mocking web services

For one of the projects i manage i have two teams and in the end, one implements web services for the other to consume. In production and integration testing, things tend to go well. But when we are faced with debugging or testing the side that consumes web services, we need something more.

I love do discover new things or new ways of doing things, enter EasyMock ( It is a small nodejs web server that returns any file on disk with extra options in it’s config.json file.

You install it with :

$ npm install -g easymock
And you start it within your work directory with :
$ easymock
Server running on http://localhost:3000
Listening on port 3000 and 3001
Documentation at: http://localhost:3000/_documentation/
Logs at: http://localhost:3000/_logs/

If you wanted to mock a CurrentUserCount rest web service which is located at /api/CurrentUserCount, all you need to do is create a “api” directory with a file named “CurrentUserCount_get.json” within it. Here is that result :

There is even a handy automatically created documentation page:

Happy mocking !

My #HitRefresh moment

As a @Microsoft MVP, i got an award for helping people with technology. I can give a talk, i can coach a team, but how do help more. Here is my #HitRefresh moment:

Working collaboratively is hard, yet it is the basis ouf of how we live – we have families, we have collegues and we have friends. When we realised how hard this problem was to solve; we #HitRefresh and rethought how digital tools can help us work together and accomplish more : a studio for all of your things to do.

We are not ready yet, but we are working hard to bring it to you soon.

This post is part of the collection of #HitRefresh moments. Read more at

Custom nuget feeds with Visual Studio Online Build

So I was working on DayTickler, and we suddenly decided to start using Xamarin controls from Telerik(Progress) and Syncfusion. Traditionally, that usually meant downloading the installer and then referencing the proper assemblies from the local drive. Another workflow was to copy the assemblies to the project directory in some sort of “lib” folder so that those assemblies could be used in a CI environment.

Fast forward to 2016  and we have something called Nuget, so i tried using these to achieve the same objective. The first was to add the two nuget feeds to Visual Studio’s Nuget configuration screen. Easy enough and from there, i was able to provide my Telerik credentials (their feed is private) and install the packages. Yay !

But when you commit to Visual Studio Online, there is no way to build because it would now fail on package restore.

The solution is to:

1 – Create a nuget.config file in the solution so that the build server knows where to download nuget feeds from:

2 – Open your build definition, and in the “Feeds and authentication” section, go point to your nuget.config file:

3 – Press “+” near “Credentials for feeds outside the account/collection”, and add the appropriate details.


That’s it ! worked like a charm and there is a “Verify connection” button to ensure all is good.

For enterprises, creating a web site that can link to files stored locally to work with “desktop apps”

One of my clients wanted a way to interact with local files (open folders, launch the associated application) from a web page. In this way, they could construct home page for the user and link to “local files” the same way as if they were on the internet.

This worked using IE (not Chrome nor Edge) through the file protocol. You could effectively do this :

<a href="file://t:\data">Data directory</a>
<a href="file://t:\data\file.txt">text file</a>

And the web page (on IE) would render two links, which would either open the folder in explorer or the file in notepad.

How would you fix this problem with Chrome and Edge ?

What we have prototyped is the creation of a UWP app that registers two URL protocols. Then you simply use these protocols in your web page and the UWP app will handle the request and do something, effectively bridging the gap between web and desktop…

Here is the updated HTML:

<a href=”myAppOpenFolder://t:\data”>Data directory</a>
<a href=”myAppOpenFile://t:\data\file.txt”>text file</a>

Once that is done, you need to create a new UWP app and register your new protocol declarations in the manifest, it should look like this:

 <uap:Extension Category="windows.protocol">
 <uap:Protocol Name="myAppOpenFolder">
<uap:Extension Category="windows.protocol">
 <uap:Protocol Name="myAppOpenFile">

Once the manifest is done, you simply handle the situation in you app.cs:

protected override void OnActivated(IActivatedEventArgs e)
if (e.Kind == ActivationKind.Protocol)
var protocolArgs = e as ProtocolActivatedEventArgs;

if (protocolArgs.Uri.Scheme == “myAppOpenFolder”)
Windows.System.Launcher…. (protocolArgs.Uri);
else if (protocolArgs.Uri.Scheme == “myAppOpenFile”)

Windows.System.Launcher…. (protocolArgs.Uri);



Understanding NetStandard

I was working on DayTickler and authentication when the latest Azure Mobile Client was released. Being fearless, i decided to upgrade.

Turns out the new version of the nuget doesn`t support pcl, but netstandard. No problem, let`s upgrade everything to netstandard, i need it for things like the latest AutoMapper anyways.

NetStandard is the new name for portable libraries. They are not built X time for each platform but offer binary compatibility for each platform. For example, uap10 implements netstandard 1.4, meaning that any UWP project can target libraries of type netstandard 1.4 because it provides and implementation of all the 1.4 level api…

It`s really complicated, but i always go back to this post, mainly for this table :

.NET Standard 1.0 1.1 1.2 1.3 1.4 1.5 1.6 2.0
.NET Core 1.0 1.0 1.0 1.0 1.0 1.0 1.0 2.0
.NET Framework (with tooling 1.0) 4.5 4.5 4.5.1 4.6 4.6.1 4.6.2
.NET Framework (with tooling 2.0 preview) 4.5 4.5 4.5.1 4.6 4.6.1 4.6.1 4.6.1 4.6.1
Mono 4.6 4.6 4.6 4.6 4.6 4.6 4.6 vNext
Xamarin.iOS 10.0 10.0 10.0 10.0 10.0 10.0 10.0 vNext
Xamarin.Android 7.0 7.0 7.0 7.0 7.0 7.0 7.0 vNext
Universal Windows Platform 10.0 10.0 10.0 10.0 10.0 vNext vNext vNext
Windows 8.0 8.0 8.1
Windows Phone 8.1 8.1 8.1
Windows Phone Silverlight 8.0


Also, if, along the way, you wish to include non netstandard libraries in your netstandard library,  you can modify your project.json like this :

“frameworks”: {
“netstandard1.4”: {
“imports”: [ “portable-net45+win8+wpa81” ]

It helps !

Microsoft Build 2017 WishList

Microsoft Build 2017 is right around the corner, with keynotes streaming live in about 24 hours !

This is my reading of the Windows ecosystem, and what i would like to see announced… My new thinking is that an operating system is just a management thing, the APIs are all similar now… there is no reason i should be choosing my OS based on the apps available but rather how i want to manage it. Oh, and the web with PWA apps is going to kill it all…

The big messages are :

  • Make Windows shine as a managed platform.
  • Every Windows device should be an Android device ++. We need the apps.
  • Every desktop-laptop Windows device should be a Linux device ++, this will bring in the entire academic and scientific public to Windows.
  • Make Windows cloud first, mobile first. Make it sync my life. Make it replace my phone. force a eSIM in every device and provide the service. Help us get ride of our telcos with take our money and offer zero innovation.

Here is the detailed list…

  1. Win32 Apps can now be on the store, and run everywhere windows can (desktop, laptop, tablets with ARM and Intel), you require a traditional Windows license to run Win32 outside of the store.
  2. UWP for redstone3  is the new API to build professional apps. The API surface will be augmented so that it is years ahead of any other API we have to build apps. It is 3d ready, mobile ready, cloud ready, sync ready… Works everywhere like RPI, desktop, laptop, tablets, phones, xbox, smart tvs.
  3. Xamarin is the way to build cross platform stuff using Microsoft technologies. These apps will shine on Windows and Xamarin will provide some sort of universal platform service API to compete against the Google PLAY specific APIs.
  4. Android apps can be downloaded from the Windows Store on any platform and things just work. Developers only need to submit their APK to the Windows Store. If you can’t beat them, join them. Microsoft has to differentiate itself by offering a better management platform and THE API to develop professional apps. An Android page exists in the settings app to manage the interoperability.
  5. A single shell that adapts to every device seamlessly (CSHELL), extend Continuum.
  6. An interface that doesn’t make me jealous of iphones (NEO).
  7. The development pace for EDGE will augment and will now be distributed in the store so that PWA is fully supported by redstone3. Also web sites will be deeply integrated into the OS and will not feel any different than UWP apps.
  8. EDGE will be enhanced to become the premier note taking and research tool. Complete integration with OneNote.
  9. Skype for UWP actually made usable and will integrate functionality for Skype for business.
  10. Skype will offer SkypeIn to everybody on earth so that i can answer the phone from my phone, laptop… With good rates on roaming and data. All Windows tablets should be eSIM compatible.
  11. Office will get it’s act together and put in the store great apps, current mobile office apps will remain as readers and light editors for the road.
  12. LXSS (linux subsystem for windows) will become official (not just a developper feature) in Windows PRO and have a it’s own page in the settings app.
  13. When you launch a feature, launch it globally
  14. Make Cortana able to have conversations, enhance it with bots.
  15. Indirect displays (Display link based USB monitors) will be made super efficient (this is a pet peeve since the new driver architecture)

On the hardware side…

  1. Come out with a small dongle that costs 50$, feels like a Roku with a remote like the Roku, and supports miracast, dlna – upnp, EDGE browsing with the wireless air mouse remote, continuum and UWP apps. Call it the YBOX or something. Make it do everything the XBOX can (minus heavy gaming) for 50$. The YBOX is even integrated in monitors and TVs.
  2. Come out with a surface phone that is the center of my life. It has an accessory called Surface which is basically a tablet (8, 10 or 12 inches) and a pen which is basically a second screen for my phone. Requires a Surface Phone to work otherwise you are limited to browsing the web with EDGE via WIFI. Can display any app that my phone is running (win32, UWP, android, PWA) via some Continuum technology. Can extend to my other Windows devices in seamless way.
    For example I turn on my laptop and see Visual Studio in my task bar (running on my laptop) as well as Facebook (an android app running on my phone but being broadcast to my laptop) as well as Twitter (running on my laptop but state being pushed from phone because the apps are both UWP and can sync state).
  3. Keep the Surface Pro, Surface Laptop and Surface Studio lineup as is…

On the media side…

  1. Support live tv and radio by region for a base streaming fee (5-6$ per month), allow plugins for cable providers (i.e. Videotron, Bell or even Netflix)
  2. Support magasines and newspapers as well as ebooks in the store, have an all you can read package for 10-15$ per month).
  3. Google gobbled up Songza… get your hands on DI.FM, evolve it a bit and offer it everywhere for a base streaming fee (3-4$ per month).