.NET South East September 2017 Meetup With guest Jon Galloway

Last night was the second .NET South East meetup event and it was a special one. Through a bit of scheduling luck I was able to co-ordinate with Jon Galloway and make plans with him to join us for the evening; before returning with him to London today to attend the Progressive .NET conference.

Planning

After our first event we decided to slightly refine the entry and sign in process to make it easier for our Madgex volunteers to manage. We decided to sign in the attendees downstairs in the foyer with two volunteers – Chris and Martin – kindly helping to do that. We also moved our networking area (where we provided snacks, soft drinks and beer) into our office entrance area. There was a little more space for people to talk and it made it easier for Trev, another volunteer on the evening to watch for anyone trapped in the corridor when returning from the toilets!

As expected, we had major interest in this evening, with the RSVP limit of 60 reached in about 24 hours of announcing the event. With a few days to go our RSVP list had grown to around 14 people and it was clear we had a good chance of full attendance. From the last event we knew that 60 would be pushing the available space to its maximum. This presented a slight concern as we were conscious that whilst we wanted to accommodate everyone who arrived on the night, we might have people showing up who were not on the list. We had announced beforehand that to be as fair as possible we would have to limit entrance to those on the RSVP list. In the end we had a few last minute cancellations and no-shows so our numbers were about perfect.

The Event!

On the day of the event, Madgex had held a company meeting in the space we would be using for .NET South East. This was quite handy since it meant most of the chairs were already out and setup. After the company meeting I spent the next hour making sure everything was neat and in order. As with the last event, time seemed to disappear very quickly. This time the Madgex staff decided to order pizza which was rapidly consumed before the event began. 

At 6pm I headed out to meet Jon at his hotel, just around the corner from our office. It was great to finally meet Jon in person after chatting back and forth for a little while. We walked back to the office together and ran through the rough plan for the timings of the evening. Once in the office we did a quick technical check to make sure Jon’s laptop would output on the large TV we use for the event.

This month, I had decided to bring in my dSLR camera (5D Mark II) and a couple of lenses for the evening. Outside of developer work, my wife and I are (occasional) semi-pro photographers and so have a lot of equipment from photographing weddings etc. The photographic results from the first meetup were a little poor due to the low lighting. Despite our best efforts, most were either noisy, blurry or both. I hoped that by bringing in the pro gear I could hopefully get a few more shots to use to promote future events. I’ve yet to have time to check and process the photographs from the event. The ones included here are from my phone. I’ll add more at a later date.

In the end we had 53 attendees (including myself) and filled every seat in the room. A massive thanks again to everyone who attended the event. It was great to see some new faces among those returning after the first meetup in August. I’m terrible with names and faces so apologies to anyone I had forgotten from the first event!

Intro and News

Just after 7pm we gathered everyone in the conference room, ready for the event. I opened the evening with my introduction, including thanking our fantastic sponsors and then went on to discuss some of the news items I had gathered for this month.

SignalR Core Alpha

The first topic I touched on was the upcoming release of the first alpha of SignalR Core. I was a little premature in this news item as technically the announcement is not due until later this week. I was basing this news item from a pre-announcement-announcement by Damian Edwards during the ASP.NET Core community standup. This is SignalR re-imagined and re-written on top of ASP.NET Core 2.0. SignalR is a real-time framework to support cases where you need to send messages from the server to connected clients in real-time. Application can include classic chat scenarios, gaming, real-time dashboards and notifications.

To learn more about what the team have been working on you can view this video from Microsoft Build 2017.

Source Linking

The second news item I focused on was the ASP.NET Core support for Source Link, a feature which now enables us to debug into the ASP.NET Core source from our application. This is a useful feature, particularly for learning more about how ASP.NET Core works under the hood. I shared details of my early use if this feature, along with a few items I could not get working. I mostly referred to the information I’d collected for my Debugging ASP.NET Core 2.0 Source blog post.

.NET Standard 2.0 and .NET Framework 4.6.1 Issue

The final item I decided to include was some information about an issue with .NET Standard 2.0 with .NET Framework & NuGet as documented in this GitHub Issue. The short summary of the issue is that in some cases, when consuming a .NET Standard 2.0 library from a .NET 4.6.1 project there can be runtime crashes or compile time warnings due to the handling of dependent assemblies. This stems from two possible causes, the possibility of missing binding redirects and/or entire missing binaries. The team are aware of the causes and are working to address this in Visual Studio 15.4. In the issue Immo Landwerth provided some workarounds that might help in the interim.

.NET Conf

I also mentioned the .NET Conf event again, which is running in September. It’s a free, streamed conference organised by Microsoft which include a lot of great .NET Core 2.0 and ASP.NET Core 2.0 content from experts in their field.

I hope the news content is adding some value to the monthly events. I didn’t feel that my presentation was quite as polished as my first time. Partly due to having to try and consume and remember the key points of the items, with only a little time to absorb it. The tough thing with news is that it’s, well, new! So pulling together a few cohesive points and then talking about them without rehearsing is not that easy for me. Maybe I can convince a sponsor to provide a teleprompter for the next one!

Talks

With such a rare opportunity to have someone directly linked to the ASP.NET team join us we took full advantage, with Jon kindly presenting two talks during the evening.

Jon Galloway – What’s new in ASP.NET Core 2.0

Jon Galloway - Introducing ASP.NET Core 2.0

In this talk, Jon managed to pack in a summary of the many new ASP.NET Core 2.0 features. It was a demo packed hour as Jon discussed and showed examples of the improvements since the 1.x release.

Jon started with a quick overview of .NET Standard 2.0 and why this is an important feature for developers, providing better compatibility of libraries between the different platforms. Jon likened the .NET Standard to HTML specs which is a good analogy to understand why we need a standard. Jon gave an example of Keen.io who develop an event data platform. They were able to take their existing PCL libraries and convert them to .NET Standard 2.0, simplifying code sharing between their platforms.

Jon went on to talk about the new AspNetCore.All metapackage which takes advantage of the runtime store which now ships with the .NET SDK. This store provides pre-jitted, optimised versions of the packages which any application using the .All meta-package will take advantage of. Jon also demonstrated the simplification and changes in the Program.cs and Startup.cs files.

Next was a big new feature in ASP.NET Core 2.0, Razor Pages. This is a new pattern built on the existing MVC system which aims to simplify and remove some of the ceremony of the traditional MVC pattern for less backend-heavy pages. It’s a feature I really need to spend some time taking out for a spin.

Jon then showed some of the additional templates we have available for ASP.NET projects, such as Angular and React. These stem from Steve Sanderson’s work on Javascript Services.

Jon concluded with a big slide of smaller features and improvements that all made it into ASP.NET Core 2.0. It was an information packed session and really great to have all of the key changes made easily accessible to the audience. We had a good mix of developers, some who had used ASP.NET Core and some who had not yet had chance to work with it. This talk had something for everyone.

Jon Galloway – The .NET Foundation

Jon Galloway - .NET Foundation

In Jon’s second talk the theme was the .NET Foundation, of which Jon is the Executive Director. In this 45 minute session, Jon took us through some of the goals of the .NET Foundation and explained the work they do with open source projects.

First Jon talked through some of the phases of open source contribution for developers. This was a scale from the fear and uncertainty that developers and business can feel about even using and consuming open source, up to fully embracing it, sharing and maintaining open source projects with public roadmaps. More details about these stages can be found at A Wider NET.

Jon then detailed at a high level some of the phases of Microsoft’s own adoption of open source, from the earlier toe in the water with some source open code (read, don’t use or change) through to where they are today, developing out in the open with .NET Core, ASP.NET Core and even things like the documentation and the C# language specifications.

A small part of the .NET Foundation is to act as an ombudsman between open source projects and consumers to try and ensure that the project is acting in the interests of its users and responding appropriately to legitimate issues. A much larger part is the support the .NET Foundation can offer to projects in the form of sponsorship as part of the community project membership. This is not about monetary funding, but about providing advice and services to the projects. This can include things such as helping set up wildcard certificates or providing some Azure credits for example. The goals here are to help make sure the projects continue to thrive and do not die out. This is a very important thing for consumers of the libraries, particularly in enterprise situations, that may rely on these projects in their code. The foundation does not run the projects but works to support them as much as possible. Jon likened this to Open Source as a Service!

Jon also talked about the recent .NET Summer Hackfest, a 6 week event aimed at getting new contributors into open source with support from some great projects such as Brighter and Humanitarian Toolbox. Jon hopes to makes this an even bigger event next year. Contributing to Open Source for the first time can be a daunting prospect and the idea of bringing forward some friendly projects who can put together some smaller, bite-sized issues that new contributors can pick up is a great one.

It was really great to hear about what the .NET Foundation is doing to support the .NET ecosystem and to help the community open source projects to thrive and be sustainable for the long term.

A bit thanks to Jon for fighting through the jet lag to present these two great talks and for making the arrangements to come straight down to Brighton from the airport.

Prize Draws

With the end of the evening closing in, before heading off to the pub we drew the winners of the prizes from our fantastic sponsors for the event. The prizes we had to offer were:

JetBrains

One year individual subscription to any single JetBrains Toolbox product

Progress

  1. UI for Xamarin license code
  2. T-Shirts x 5

Manning

  1. ebook of choice

elmah.io

6 months Small Business license

Last time I draw names from a bowl. A bit low tech and also time consuming to print and cut up all of the names. Dan Clarke, fellow .NET user group leader has created a desktop app which randomises winners from the Meetup.com RSVP list. He has kindly provided the application code on GitHub. For this event I decided to give that a go. It worked quite well and simplified things nicely, although I was still conscious that at the end of the evening, it takes a little time to draw all of the prizes. One big advantage is that it stores the winning member ID so we don’t have to worry about duplicate names causing us to require some kind of tie-break. I am pondering whether for the next event I pre-draw the names using the app to save some time.

The rules as with the last event were:

a) names are added from the RSVP list (as at about 1 to 1.5 hours before the event)
b) if the name drawn is not in attendance, we redraw.

Next events

We have some great speakers lined up for the next couple of months, and I’m working with a few people of plans for the next couple of months after that.

.NET South East October 2017 – Rabeb Othmani
Rabeb joins us with her talk “Welcome to the age of conversational interfaces” – looking at how we can build interfaces using SMS, voice and bots.

.NET South East November 2017 – Michael Newton
Michael joins us with his talk “Making Distributed Systems in .NET Easier” – discussing distributed architecture with .NET.

Call for speakers

I’d love to get a range of varied content and speakers to present at our user group. We have a nice pipeline for the coming months but those months will fly by very quickly. If you’d be interested in speaking at a future event we’d love to have you. Please get in touch via the contact form on this blog or ping me on Twitter and we can discuss availability and topics.

I’m really keen to draw as many speakers from our local community too so please let me know if you might be interested in speaking. Perhaps you have presented a talk internally and could open it up to a wider audience. I highly recommend speaking as a way to develop professionally. I’m happy to offer advice for new speakers and help where I can.

Links

Some links from this months event:

Debugging ASP.NET Core 2.0 Source Code Using ASP.NET Core symbols with Source Link support

In the early days of ASP.NET Core 1.0, before Visual Studio 2017, back when we had the project.json project format, we were able to take advantage of a nice feature to enable source debugging of referenced libraries and code. We could add the paths of cloned source repositories into our global.json file and these would then be preferred over Nuget when available.

I used this quite extensively when writing some of my posts for my MVC Core anatomy series (something I hope to get continue with at some stage). I blogged about how we could set this up in this previous post – Debugging into ASP.NET Core Source. Unfortunately with the switch back to MSBuild and csproj, we lost the ability to easily debug through the ASP.NET Core source files.

Yesterday during the ASP.NET Community Standup Jon Galloway highlighted a tweet by David Fowler regarding new ASP.NET Core source linking support. Damian Edwards went on to provide some more detail about this new feature and afterwards I decided to take a quick look at it myself. I expect this post to serve as an early introduction to source linking and I will hopefully blog on more detailed elements once I’ve had time to explore them more fully. For this post we’ll focus on how we can get started with debugging into the ASP.NET Core source using source linking.

What is Source Linking?

Let me caveat this explanation with the fact that symbol files are not something I’ve previously messed around with besides knowing that PDB files existed. I’m coming at this blog relatively fresh. I’ll be explaining things as I’ve understood them so far and will happily make corrections and updates if necessary.

Like me, you may have noticed PDB files being created under some circumstances when compiling your code. These files hold the symbol information which can optionally be used to support debugging into external source. Some types of symbol files may contain some of that source code or mappings to the source code.

For a long time Microsoft have hosted Symbol servers which hold published symbol files for the Microsoft products such as .NET Framework and ASP.NET Core. Visual Studio supports downloading symbols dynamically. To do this you must disable the “Enable Just My Code” option in the Debugging > General options. By default this option is enabled in Visual Studio.

Enable Just My Code Option

For more information on Symbols, Symbol Servers etc see this MSDN link.

Source linking allows you to embed a manifest inside the symbol file. For a given method name and location in the method that is being called it can identify what file contained the code and where it can be retrieved from. The ASP.NET Core libraries (not .NET Core currently) now support Source Linking and provide links to the code which is hosted on GitHub.

Enabling and Using Source Linking

The first requirement is that you are running Visual Studio 2017 on the latest update (15.3) which added Source Link support. With this installed if you check the Debugging > General options you will see Source Link enabled.

Enable Source Link support

As well as ensuring “Enable Just my Code” is not checked you must also enable the Microsoft symbol servers. In the Debugging > Symbols options you can check the “Microsoft Symbol Servers” from the list of symbol file locations.

Enable Microsoft Symbol Servers

When enabling the symbol servers you will need to accept the possibly the performance impact that it may introduce when debugging.

Symbol Server Performance

We are now setup and ready to debug into the ASP.NET Core source. To test this I created a default ASP.NET Core 2.0 MVC project inside Visual Studio. I then added a break point to the Index action on the HomeController. I then started debugging the application. The first time when debugging you may see messages like this in the status bar.

Loading Symbols

This is the symbol files being downloaded and may take a short while to complete.

Once you application is running and the breakpoint in your code is hit you can navigate down the call stack to see all of the external ASP.NET code that is being executed.

Call Stack Source Link

 If you double click any of these calls the editor will use the symbols to determine where that code is located for the frame. Using the link inside the symbols file, Visual Studio will download the source file from GitHub. When Source Link needs to download source you will see a warning dialog like this:

Source Link Dialog

You can chose the first option to download for this specific source file and continue to debug using that file. If you chose the first option you will see this dialog for each new source file that is required. You can select the second option instead which will download the file and disable the warning for future files.

Now that we have the source it will be displayed at the appropriate location from the frame you selected.

Source Link External Code

Now that we have the source file, you can also add your own breakpoint somewhere else within that file which will then be set to be hit when debugging your application. Even if we stop debugging and start again, this still seems to be hit successfully.

External Source Breakpoint

I was also curious about how we could set breakpoints in other parts of the code, without having to rely on access the source via the call stack. Damian mentioned a feature I’d never used where we can set a breakpoint manually from the breakpoint window. I have attempted to set a new function breakpoint up to one of the ASP.NET Core methods but so far I haven’t been able to get it working as Visual Studio states that the source is not available. I will pursue this and hopefully include details in a future post.

Summary

It’s great to see the beginning of easier debugging of external source coming to ASP.NET Core. Already there is value that I can gain from this feature to allow me to debug into the ASP.NET Core source to understand the internal workings. It’s not a sweet as what we were able to do back in project.json days but is certainly a step forward since we went back to csproj and MSBuild.

I miss the simplicity of cloning the full source for a repository and being able to navigate through it and add breakpoints to the external code. The source linking mechanism is good for more specific debugging cases where you want to dive into the external call stack. At the moment, once you have the source cs file via Source Link, you can’t navigate to other methods so exploring the code and setting further breakpoints is not possible outside of that file. If I can get the manual breakpoints working then that will be slightly better as at least I can view the source and determine methods I might want to break on, then set those up manually.

Chatting to David Fowler on Twitter I also understand that more features are being planned so I’ll be watching for those with interest. In addition, work is underway to get this supported by other non-Microsoft OSS projects such as Xunit and maybe in the future, JSON.NET. This repository (which I’ve not dug through yet) provides some build tools which can help creating source link symbols. I will also be looking at this more in the future.

Further References

Portable PDB files

Source Link