Monthly Archives: August 2017

My talks in September

.NET, Azure, Azure Functions, Microsoft, MVVM, Work, Xamarin
No Comments

I don’t know about you but I had an amazing summer. I had the amazing luck of spending time in beautiful places in the Philippines, Iceland and then 2 great weeks in Seattle and Redmond. Having started to work with Microsoft on August 1st, it was great to be on campus in Redmond as a blue badge.

Apart from sitting down with my new team, meeting my new manager and old friends on campus, I also delivered two sessions at the Visual Studio Live conference. The event took place at the Microsoft conference center (Building 33) and was as packed as usual with great speakers and very competent attendees. This year was special for me because my two talks took place in the Cascade room, which is a really nice auditorium with all the comfort. I also had a lovely time interacting with attendees at the traditional Birds of a Feather lunch, where a table is assigned to a speaker and attendees can go around the room, sit down, ask questions or just chat.

You can find the slides, source code and all the information about my two talks on my website:

Amsterdam: MVVM Cross Hackfest

My next engagement is the closing event of the MVVM Cross Hackfest taking place in Amsterdam on September 2nd. The .NET Open Source foundation is sponsoring this event with others, where the aim is to encourage new contributors to help open source projects. For MVVM Cross, the event is the occasion to port this popular framework to .NET Standard. While the project lasts 2 weeks, September 2 will be the last day with a celebration, some lightning talks and a party.

At this occasion, I will speak about Azure Functions (which are really awesome). My Microsoft colleague Mike James will also be there and speak about other Azure services. The rest of the lightning talks will be held by MVVM Cross contributors. You can see the program here. My session’s abstract is the following:

Azure Functions and Xamarin

One of the most exciting recent additions to Microsoft Azure is called Functions and allows the developer to quickly build and deploy code to the cloud without complicated setup. Also dubbed “serverless computing”, Azure Functions can be triggered by timers, HTTP calls or database operations, and can communicate with other Azure services or mobile and desktop applications such as those made with Xamarin. In this lightning talk, Laurent Bugnion, Cloud Developer Advocate for Microsoft, will give you an introduction to Azure Functions and get you started with this exciting aspect of modern computing.

Singapore: MonkeyFest

A little later in the month, I will fly to Singapore to attend the MonkeyFest conference which is a Xamarin event organized for the first time in the beautiful south east Asian city. There is a nice team of speakers speaking on a variety of topics. The entrance tickets can be purchased for 19 Singapore dollars, which is very cheap for such a quality show! We hope to see a lot of attendees at Microsoft Singapore!

Building truly Universal applications with Windows, Xamarin, MVVM and Azure

With Windows 10 supporting an unprecedented number of platforms and form factors (from IOT to phones to tablets to laptops and desktops to XBOX and SurfaceHub, and even the new HoloGraphic computer HoloLens), the name “Windows 10 Universal application” is fairly accurate. But to be honest, shouldn’t a truly Universal application run on Windows 7, iOS and Android devices too? Thankfully, this is possible thanks to a clever architecture pattern named Model-View-ViewModel, the .NET portable class libraries and the Xamarin frameworks. With these tools, we can structure an application so that most of the code is shared across all the platforms, and then build truly native UI that adapts without any compromises to the device it runs on. In this session, we will understand exactly how such universal applications are built. Laurent Bugnion, a XAML/C# expert, Microsoft and Xamarin MVP who started making universal applications before it was even a thing, will show you practical knowledge with a lot of demos. Come listen from the creator of the popular MVVM Light Toolkit how this powerful but simple library can be leveraged to help you target more users than you ever dreamed of!

Come say hi!

I hope that I will have the occasion to see a lot of you out there. I have more talks coming up in November – but that is for another post. Please come say hi!

Happy coding
Laurent

GalaSoft Laurent Bugnion
Laurent Bugnion (GalaSoft)

Share on Facebook

Running unit tests on Azure Functions in Visual Studio 2017

.NET, Azure, Azure Functions, Microsoft, Technical stuff, Visual Studio
No Comments

TL;DR; You should really update your Nuget packages

I am currently experimenting a lot with Azure due to my new job and also of course due to the really cool innovation that we can find there. Recently I got interested in Azure Functions. This cool feature allows to write a small piece of code that runs on Azure and can be triggered by various events (time based, HTTP-request based, etc). For example, imagine that you have a value that keeps changing and you want to monitor this value and do some kind of analytics on this. In the code I am currently writing, I am using the value of a Bitcoin as the sample, and I am just periodically reading this value and storing it into an Azure database.

For this small functionality, it would be much too complicated to set an entire server-based application up. This is a perfect example for a time-based Azure Function. I am not going to explain more about Azure Functions here, because I am working on a complete article including sample which will do that. But in the course of my investigation, I stumbled upon an issue that can easily be solved.

The problem:

The issue arises when you try to write unit tests for your Azure Function. In many examples I saw, the Azure Function was created straight in the Azure portal, which is great but makes it a bit difficult to unit test the code. Thankfully it is also possible to create the Function project in Visual Studio, and to take advantage of all the features including unit test, code coverage etc.

To do this, try the following:

  • Install Visual Studio 2017. I currently have the Update 3, which is the most recent at this time. Make sure to select the Azure workload when you install Visual Studio!

Click to see the full picture

  • In Visual Studio, select Create new project.
  • In the New project dialog, select Cloud on the left, and then Azure Functions.
  • Give your project a name and then click OK.
  • Right click on the Function project and select Add, New Item.
  • In the Solution Explorer, right click on the solution and select Add, New Project.
  • In the Add New Project dialog, select the Test category, and then Unit Test Project (.NET Framework).
  • Give your unit test project a name and then click OK.
  • In the Unit test project in Solution Explorer, right click the References folder and select Add Reference.
  • In the Reference Manager dialog, select Projects and then the Function project that you created earlier. Then click OK.
  • Build the solution.

If you have the same setup as I have, you will get an error stating something like:

Metadata file ‘C:\Users\Laurent\Documents\Visual Studio 2017\Projects\FunctionApp2\FunctionApp2\bin\Debug\net461\FunctionApp2.dll’ could not be found

Indeed, if you check the path in Windows Explorer, you will see that there are no DLLs under FunctionApp2\bin\Debug\net461. There is however a folder under FunctionApp2\bin\Debug\net461\bin which contains all the DLLs. The issue is that the Functions project does not generate its output to a standard path. As a result, the Unit test project does not find the reference it was expecting.

The resolution

After reaching out to the Azure Functions team, I found out that this is a know issue and that an updated project template for Visual Studio will be released soon. But there is already an easy fix that you can apply to your project today: You just need to update your Nuget packages, and this will apply the fix to the Functions project.

  • In the Solution Explorer, right click on the Solution and select Manage Nuget Packages for Solution.
  • Under Installed, select the Microsoft.NET.Sdk.Functions package.
  • On the right under Versions, select the Function project. Note that the version shown is smaller than 1.0.2 (likely 1.0.0).
  • Below this box, make sure that Latest stable 1.0.2 is selected in the Version combo box and then click Install.
  • Build the project again. This time it should succeed.

Click to see the full picture

Conclusion

This was an easy fix that the Azure Functions team was able to deploy to your project using an update to the Nuget package. Of course, there are good reasons why teams are sometimes reluctant to apply an update: They might fear that the update brings breaking changes, or that something might go wrong unexpectedly due to regression bugs etc. But when you create a brand new project, it is a good idea to apply the Nuget updates to the solution. This way you will make sure that your new project starts with the latest and greatest.

Thanks to the Azure Functions team for their help solving this issue!

Happy coding
Laurent

GalaSoft Laurent Bugnion
Laurent Bugnion (GalaSoft)
Share on Facebook
 

Joining Microsoft

IdentityMine, Microsoft, MVP, MVVM, Personal, Universal Windows Platform UWP, Valorem, Work, Xamarin, XAML
16 Comments

Well here is a post I didn’t quite expect to write… but the best things in life are unexpected. I am thrilled and proud to announce that as of August 1st 2017, I joined the Cloud and Enterprise group (aka Azure) at Microsoft.

My role will be a Senior Cloud Developer Advocate and I will explain in this post what it is I will do! I guess an FAQ format is most appropriate here, so here goes:

Are you moving to the USA?

No, I am staying put in Zurich Switzerland, my home for the past 23 years. While I don’t exclude living in the US at some point in the future, now is not that time and I will stay close to the friends and family I have in Switzerland. The role is global, and I will be travelling about the same amount than I am now, including coming to Redmond about 3-4 times a year and going to events worldwide.

It’s really interesting to see all the new people joining the team and I can’t wait to hear more about who else will get on board. Because it is a global role, we will have local offices around the world (in exciting places such as London, Shanghai, Bangalore etc). I really hope I will have a chance to be present at events in places where I couldn’t go yet, especially in Asia and South America. While I am super happy about all the talks I gave in Europe and the USA, I feel that it’s time to go “advocate” in more places now. Can’t wait to create that content and teach.

What will you do?

This is the most interesting part! This group is helping to redefine how we engage with developers on a big scale and be an empathetic advocate to the product engineers building the tools, services, APIs and other tech you use on a daily basis!

If you follow Twitter, you might have seen quite a few very talented people joining the Developer Advocate group. These people have very diverse skills, from web to open source to Linux to Docker and more. Even though I will be “advocating” Azure, my main expertise is going to be with Xamarin development and cloud-connected mobile app experiences, and of course MVVM. XAML has been a primary interest for more than 10 years now, and Xamarin is a technology and a team that I worked with for the past 4 years now. I am really enthusiast about working with these technologies even more intensively now, and most importantly to teach people worldwide how to use them.

Who is employing you? Who is your boss?

Because I am living in Switzerland, technically I will be an employee of Microsoft Switzerland. But I am reporting to Tim Heuer (a great friend!) who is based in Redmond. Our team is a part of the engineering group in Azure and reports up through Scott Guthrie. It’s kind of a hybrid situation, and I expect to be regularly in Wallisellen in the Microsoft Switzerland offices, as well as in Redmond for team meetings a few times a year.

What makes you most excited about this job?

Difficult to answer. When I received the call three months ago, and heard about the amazing job description, I thought it was just great for me. In a later call, I heard that Tim Heuer would be my boss and that was an amazing cherry on a fantastic cake. I have to admit that the thought of getting into Microsoft at this time, under Satya Nadella and Scott Guthrie, is making me very happy. It is a great time for Microsoft and especially Azure. I started getting more and more interested in Azure after I joined the Microsoft Regional Directors group. This group of experts is composed of very experienced people who have strategic roles in various firms, big and small. A large portion of the discussions have been focused on Azure, which led me to understand how important this technology is. There are just so many applications and the pace of innovation is quite breathtaking. I have a huge respect for everyone I will be working with, and especially of course for Scott Guthrie, who I have met many times over the past 10 years. He is as nice as he seems but most importantly, he is really, really clever and drives innovation amongst his people. I am delighted to be a part of this new adventure.

What do you regret the most?

I will certainly miss working for Valorem and especially all my friends. I met some of you guys 10 years ago, and we have been working together as a team for more than 8 years. I will be forever grateful to the IdentityMine team who gave me a chance in 2008 and decided to create a whole branch in Switzerland just for me. I think in retrospect it was a win-win, just look at all the amazing projects we realized!

But maybe most painful of all is the fact that I will have to resign from the MVP awards (both Microsoft and Xamarin) and the Regional Director program. Of course the joke is that joining Microsoft is the best reason for losing these awards, but I will really miss the amazing community of peers, some them who grew to become more than dear friends, a family.

Of course the good news is that I will continue to see many of you at conferences and other events around the globe. I will also continue to participate to some of the distribution lists and so we will be able to keep in touch. And as always, if you come to Zurich, let me know and we’ll have a fondue! (or something…).

Will something change for MVVM Light?

Short answer: No.

Slightly longer answer: Microsoft is very open regarding open source. I retain the full ownership of the project and I expect to be working on it about the same amount of time than I do now (of course on my free time). In the next few weeks you will see a move to Github as well as a version for .NET Standard so keep watching this space for updates.

What’s next?

Well while today is officially my first day at Microsoft, it is also Switzerland’s national day (Happy 726th birthday Switzerland!) and so my first day will be tomorrow. I have the new employee orientation (NEO yay) at the Swiss HQ in Wallisellen near Zurich. I expect that I will get my blue badge as well as a ton of information. At some point I should also get a new laptop (I was given a choice between a PC and a Mac and selected a Surface Pro 4 because I still love the Surface form factor, especially when I travel). Then I will spend a few days in Redmond next week, and connect with some of the team. Really impatient to get started!

I am sure I will have a lot more to say about all this in the next few days, so stay tuned!

Happy coding
Laurent

GalaSoft Laurent Bugnion
Laurent Bugnion (GalaSoft)
Share on Facebook