.NET Oxford Meetup X: Deep Diving into Razor and Async

26 January 2018 - .NET , dotnetoxford , Meetups

Last week, was our first .NET Oxford of 2018, which now marks our second year! Our first one being January last year, meaning that we've now had over a full year of .NET goodness!

This time, we had a bit of a .NET South West takeover, where both of our speakers are involved in organising the fellow Bristol based user group. I'd met both Joe and Stuart previously at a couple of the DDD Conferences, and was very pleased when they agreed to make the trip to Oxford to speak at .NET Oxford.


Intro Talk

After welcoming everyone, I started off the intro talk talking about our first year, and how amazing a journey it had been. Both Matt and myself had never even been involved with a user-group before, let alone running one! And we were both also new to public speaking. So this really was a dive in at the deep end! We've met so many amazing people through doing this - from speakers, to members. I've also got to know people online, having conversations that I wouldn't have had if it wasn't for .NET Oxford. So whilst, it was myself and Matt that started it - it certainly required a lot more people than just the two of us - so a massive thank you to all involved. Hopefully, we'll have many more years to come!

This all led nicely into my reminding everyone about our 1st Birthday Social meal at Café Rouge on the 26th (which at the time of writing is actually today!). We'll be meeting beforehand at The Duke of Cambridge (from 7-8pm), and feel free to join us there just for drinks even if you don't want to eat at Café Rouge afterwards.

After that, I went through the usual spiel, talking about what .NET Oxford is all about, and who we are. I'm not that keen on going too much into lots of detail on this each and every meetup, as it gets boring for our regulars, and makes the intro talk longer. However, given it's a new year, and there were a few new faces, I thought it was definitely worth going through this again.

I've also just re-written our intro slides using Reveal.js. We'd been using Google Slides up until now, but after using Reveal for my Docker and ELK Stack talk last month, and loving it - I decided to switch the .NET Oxford slides to also use this. This gives us the additional benefit that they're source controlled on the .NET Oxford GitHub. We're going to tag the commits that respond to a particular meetup with the event's date. With Reveal being HTML/CSS based, this also gives us the additional benefit that they're easy to push to Azure, so we can share a link and it'll run as an actual website...


News Items

As usual, our intro section included a few hand picked news items since our last meetup...

Kubernetes v1.9 releases beta support for Windows Server Containers

The first news item was that Kubernetes have now added beta support for Window Server Containers! We're spoken about Kubernetes at .NET Oxford quite a bit before, and even had a talk on it last Month. Up until now, Kubernetes has only supported Linux containers - which given .NET Core is cross platform - isn't too much of an issue for greenfield .NET projects. But there are also plenty of apps that can only run on Windows, so this is certainly great news for those developers. It also certainly shows that Windows containers are now being taken seriously outside of Microsoft and are rapidly becoming a thing!

The official blog post announcement can be found here.

Meltdown and Spectre

I'm sure most people have heard about this in the news, but Meltdown are Spectre are recently discovered CPU vulnerabilities that between them, pretty much affect all CPUs. I won't go into detail in this post, as there's plenty of information about it on the web already, and I'm certainly no expert - but the key takeaway is to make sure you're patched up as soon as possible.

A useful website explaining it can be found here, and there's also a Mashable article about it here. A simple Google will also give an abundance of information.

HockeyApp Now FREE for all developers!

HockeyApp is an amazing tool, allowing you to distribute your applications to your testers during development. In their words: "Think of it as your personal App Store for testing.". It also supports various other features - eg. crash reporting, user metrics, user feedback, etc.

Up until recently, the free tier has been limited to a small number of apps (two if I remember correctly). They've now announced that it's free for unlimited apps!

The official blog post announcement can be found here.

Oxford Geek Nights is back!

Oxford Geek Nights used to be a very popular regular technology-agnostic meetup aimed at both designers and developers.

The last one was a year ago, and I believe the one before it was another similar large gap. They're now back, and from what I hear, will be aiming for regular 3 monthly meets. The first one being on the 31st January at Jericho Tavern.

Prize Draws

As usual, we had our three prizes for our amazing prize draw sponsors - JetBrains, Manning Publications, and Oz-Code.


Congratulations to Oksana Meme for winning a year-long Jetbrains product licence! She very wisely chose Resharper!

Manning Books

Congratulations to Ben K for winning a Manning ebook of his choice! He's not yet chosen, but he has the choice of any of the awesome Manning ebooks from their website!

Remember that we have our special Manning coupon code (ug367) which gives all of our members a 36% discount on any of their e-books! They've also asked me to share a link to some of their new courses for their LiveVideo system.


Congratulations to Matthew Clarke for winning the Oz-Code licence!

If you haven't checked it out, definitely download the trial and have a play. All our member get a free 3 month trial licence (see below) or 50% off a full licence! To claim, you can visit this link to pick up your licence!


Joseph Woodward - "ASP.NET Core Razor Deep Dive"

The first talk was by Joseph Woodward, talking about the Razor view engine, and the various shiny things that are new in ASP.NET Core.

Both Matt and myself first met and heard Joe talk at DDDSW in Bristol last year, where he did this same talk. We both really enjoyed it - so were super excited to have him down at .NET Oxford to do the same talk.


Joe started off talking about the various different view engines that ASP.NET supports. Mentioning a few I'm sure most people haven't heard of - eg. Spark, Bellevue, etc. This includes myself, if you ignore that fact I'd already heard Joe's talk. The main focus of his talk (if the title didn't give it away), was however, Razor.

The main areas he covered were ...

  • HTML Helpers
  • Tag Helpers
  • View Components
  • Razor Pages

Starting off with Html Helpers, he discussed some of the disadvantages, and basically branding them as 'awkward', with a slide showing an animated gif, that I, for some reason just can't stop watching ...


He then moved onto talking about Tag Helpers, which was the main focus area of the talk. These are bery cool, basically allowing you to write server-side .NET classes which look for specific elements or attributes in your views, and them manipulate them in different ways - adding, editing, removing HTML elements. Your tag helper classes also plug into the ASP.NET Core Dependency Injection, so you can easily inject your dependencies, and keep everything decoupled and testable.

If your tag helper is for an element rather than an attribute, you can even have attributes in your view which are automagically assigned to properties in your tag helper class with the same name. Well, I say same name - it does expect slightly a different naming convention - ie. the attribute is expected to be in kebab-case (eg. some-colour), and the matching C# property is expected to be in PascalCase (eg. SomeColor). You even get intellisense when writing your view! This makes it super-easy to have HTML attributes that control the way your tag helpers work.

Joe spend quite a bit of time demoing various ways of using Tag Helpers. One thing to note, is that he was using the awesome Rider, and not Visual Studio. For anyone following him on Twitter, this came as no surprise!

He also talked about some of the negatives to tag helpers. One of the obvious ones was the lack of transparency in the views. You're no longer able to look at the HTML and know what it's doing. Joe went through some of the potential solutions to this - eg. using tag helper prefixes to make it clear that something in the view is a tag helper.

Next up, Joe discussed View Components. I think we all now agree that splitting user interfaces into components is the way to go. We've really seen the push for this in front-end frameworks. View Components adds similar to server-side MVC apps. We already had both partial views and child actions, which help with this componentisation, but View Components are a lot more powerful, allowing you to include business logic like you could with child actions, but with Dependency Injection support, rather than having to pass your model down from the parent view.

He then wrapped up talking about some new functionality that has gone into ASP.NET Core 2.0 - discussing both Tag Helper Components, and Razor Pages, before moving onto questions.

Stuart Lang - "Async in C# - The Good, the Bad and the Ugly"

After the break, it was Stuart up talking about Async in C#! Like Joe, Stuart has also done this talk a few times at the various DDD Conferences. Up until now, I've somehow managed to keep on missing it though due to the multi-track nature of the DDD conferences. As it's a talk I definitely wanted to see, I was planning on making sure that I saw his talk at the next one. I wasn't expecting that next one to be at .NET Oxford though - so that was very cool!

We had Frans Lytzen talking about async/await last April. This is such a fundamental and important topic to cover, we definitely thought it worth covering again.


Stuart starting off introducing himself, and then talking about why he was doing a talk on Async. It basically came down to the fact that whilst async/await is pretty cool - it also gets wildly abused and misunderstood! I myself have lost countless hours across more than one company due to code (not mine!) that caused the deadlock situation, causing bugs which weren't immediately obvious that this was the cause!

One of the key areas Stuart talked about was something called Synchronization Contexts. Unless you've explicitly read about this (or listened to a talk on async/await in C#!), it's quite likely you may have been using async/await in C# for years and never heard of this. Stuart discussed these in depth, and also explained why using blocking calls like .Result, .Wait() etc. can cause the deadlock situation. I'm not going to attempt to explain the deadlock in this post, but here's a post by Steve Cleary that explains it very well. Stuart showed plenty of examples in his slides where he asked the audience whether they thought each example would deadlock or not. I thought this was a really nice way of getting the audience involved a bit more.

Stuart wrapped up his talk by summarising, and asking the audience a few questions. He also reminded everyone that the best solution when writing async code, is to always aim where possible for async top to bottom!


As usual, a few of us headed off to the pub straight afterwards. There were perhaps a few less than usual, as for some reason after Stuart finished his talk, everyone suddenly got up and start to leave - not giving Matt the chance to wrap up, saying a few thanks yous, and reminding everyone about the pub! Not quite sure why this happened, as it's never happened before - but it's something that we need to be ready for moving forward - perhaps ensuring that the person doing the wind-down talk is at the front ready to swap over straight away.

One of our new members this time, was actually my old boss Kevin Bezant, who I hadn't seen in quite a long time! So it was great catching up with him at the pub, chatting about Razorworks, and various ventures. A owe an awful lot to Kev, as he not only hired me back in 2002, but a few years later, he also hired my now wife, Anna! So if it wasn't for his awesome hiring skills - not only would I not be living in Oxford right now - but I wouldn't have met and be married to Anna, and my kids wouldn't even exist! So, nice work Kev!

Corriculo Recruitment

I certainly can't finish without mentioning our amazing sponsors Corriculo Recruitment. They've been our sponsors from the very beginning, and I really cannot thank them enough! I was initially weary about being sponsored by a recruitment company, as I've seen this taken advantage of by other recruitment companies at other user groups - and recruitment really isn't what .NET Oxford is about. But Corriculo haven't been like that at all, and it's been an absolute pleasure working with them. They've not only helped us out financially - covering the venue costs, and providing plenty of liquid refreshments at each of our events - but also, helping us out welcoming everyone in, with marketing and promotion, feedback and advice, and much more. They're also just genuinely nice people, and really great to get on with. I'm very proud to have them as a core part of the .NET team!

Please retweet if you enjoyed this post ...