Category Archives

Travels in October and November

Azure, Microsoft, Technical stuff, Visual Studio, Work, Xamarin
No Comments

These coming few weeks will be quite busy with conferences and other meetings. Here is where you might have the occasion to see me:

  • I am currently in Boston, where I will support Scott Guthrie’s Red Shirt Tour on October 19. Ultimately, Scott is my boss (‘s boss’s boss’s boss) as well as someone I have admire ever since I met him in person 10 years ago. The event is all about Azure with Scott showing demos and code across all of Azure, Visual Studio, Xamarin and more.
  • After Boston, I will be in New York City on October 20th. This is another stop of the Azure Red Shirt Tour.
The Red Shirt Dev Tour NYC edition will be livestreamed!! Join us at http://aka.ms/rstlive

  • Before going back home, I will have the privilege and pleasure to fly down to Lima, Peru on October 25th and 26th. There, I will participate to the MVP Connection event, organized by Microsoft for its Most Valuable Professionals. Unfortunately, due to travel constraints, I won’t have time to participate in any public event there, but I will most certainly do my best to come back at another occasion and speak in public.

At the MVP Connection event, I will have an hour to speak about a few exciting topics including Azure Functions and Xamarin, the Azure Mobile Center and the Xamarin Live Player. Of course I will also be available for questions and discussions around Azure, Xamarin, Windows, MVVM Light and more.

After a few days at home, I will continue with travel:

  • I will fly to Hyderabad, India and participate to another MVP Connection event on November 3rd and 4th where I will be honored to speak about the same topics as in Lima. There too, I will be available for questions and discussions, and meeting as many MVPs as I can :) Unfortunately I don’t have other stops in India in November, but I am already thinking of coming back next year!

Then I still have two conferences in November:

  • I am super happy that I can travel to Malmö, Sweden this year again and speak at the Oredev conference on November 10. I spoke there once in 2011 [TODO CHECK] and never could again because the conference was always conflicting with the Microsoft MVP summit. At Oredev, I will be speaking about HoloLens and show developers how to get started with Mixed Reality programming. This should work well with my dear friend Rene Schulte’s talk at the same conference, which is scheduled just after mine and will dig quite a lot deeper into the topic.

  • To conclude the travel in November, I will spend a couple of days in Sofia, Bulgaria on November 16th and 17th. There, I will have the honor of keynoting the ISTA conference. From their website: “Innovations in Software Technologies and Automation (ISTA) is an annual, international conference, devoted to the latest trends in software development and test automation. We are committed to support the development of quality standards in the field with focus on new technologies and best practices.” Sounds like a very exciting conference in a dynamic city of software. I had the pleasure to speak in Sofia before and was always impressed by the quality of the attendees!

I hope that I have a chance to meet some of you, dear readers, at one or the other event. Make sure to follow me on Twitter to get the details of my travels, and by all means 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
 

Solving the #Xamarin error “Unable to copy appname.dll…”

.NET, Technical stuff, Visual Studio, Work, Xamarin
No Comments

If you recently updated Xamarin to the latest stable version in Visual Studio 2015 or Visual Studio 2017, you might have encountered an annoying error when trying to build:

Unable to copy appname.dll from obj to bin because it is being used by another process

This error typically happens the second time that you try to build after you start Visual Studio. The first time everything works OK, then suddenly you cannot build anymore. Cleaning the solution doesn’t help, the only “fix” is to restart Visual Studio which is of course really annoying when you are developing.

This error is known, as shown by the Bugzilla issue #56275. There is also an old forum discussion on the Xamarin forums, which is a bit confusing because it might be a recurring error in the Xamarin updates.

Fortunately, the Bugzilla discussion also carries a workaround. This is a Visual Studio extension that you can install, which should fix the issue. I also talked to Microsoft about this and got confirmation that the error is fixed in a future release of Visual Studio. The engineer who replied to me also gave me a VSIX to fix the issue. I am not entirely sure what the difference is with the one in the Bugzilla issue, so I will just copy it here for your convenience. As far as I can tell, both VSIX files work well.

Happy coding
Laurent

GalaSoft Laurent Bugnion
Laurent Bugnion (GalaSoft)
Share on Facebook
 

Using the Windows Template Studio with #MVVMLight

.NET, Build, MVVM, Technical stuff, Universal Windows Platform UWP, Visual Studio, Windows 10, Work
1 Comment

Here is a story of a great collaboration between Microsoft and the community.

Last year in August, as I was speaking at VS Live in Redmond, I was asked by my friend Clint Rutkas for coffee because he had an idea he wanted to run by me. Now if you know Clint, that is usually really intriguing and I was really excited to hear about his idea.

Clint told me about the project he was thinking of starting. This was just conceptual at the time, but his idea made a lot of sense: Why not make the process of creating a new Universal Windows application a lot easier. Why not help people with all the tedious tasks that you get right after File, New, Project.

Usually when you get started, you need to add a bunch of pages and helpers to your application. The Blank application template is just that, blank. In MVVM Light, I added a project template for the supported frameworks (Universal Windows Platform, Xamarin.iOS, Xamarin.Android, Windows Presentation Foundation, Silverlight).

2017-05-24_11-09-27
The MVVM Light templates in Visual Studio 2017

However creating a meaningful project template is really difficult. You are constantly navigating between “too much content” and “too little content”. If you have too much, the developer ends up having to remove a whole lot of code, which is tedious. If you have too little, then the developer needs to spend time adding the basics, as well as sometimes having to look for guidance on how to do common things like navigation, dialogs, a Settings page, etc.

Building a wizard

Of course I thought of building a wizard to help people getting started. This is not easy though. First of all, the Visual Studio automation can be complex. You need to support multiple versions of Studio, and the extensibility model changes from version to version, so that is a big commitment. And this is where Microsoft has a huge advantage, they own the extensibility model, they know in advance is something is going to change, and they have the resource to create and maintain the code. And since the WTS is open source and available on Github, you can also contribute, and help make this project even better.

Installing the Windows Template Studio

Before you get started, you will need to add the Windows Template Studio (WTS) to Visual Studio 2017. Thankfully this is really very easy. In Visual Studio 2017, just select Tools, Extensions and Updates. Click the Online item on the left, and enter Windows Template Studio in the search box on the top right.

2017-05-24_09-47-08
The Extensions and Updates dialog with WTS

In Visual Studio 2017, you are now required to close the application to install the extension, so after the download is complete, close Studio and it will get installed.

Getting started

2017-05-24_11-16-46

The WTS starts in the File, New, Project dialog. Under the usual Universal Windows templates, you will see the entry for the WTS. Select it, give a name to your new application and press OK.

The project type

2017-05-24_11-19-16
The project type and framework dialog

The next screen is about the foundation of your app. You can select a type of navigation (currently you can select an app with a navigation pane, or an app with tabs), or simply a blank template without navigation.

The framework

Then comes the framework selection. This is where you will notice MVVM Light front and center. The other options at the moment are Code Behind, or a basic “no-name” MVVM implementation which can be useful in situations where the usage of 3rd party frameworks is completely forbidden.

The pages

2017-05-24_11-20-12
The pages dialog

The next step is probably the one I am the most excited about. It is usually so tedious to add the same pages over and over in every application I create. Here, you can choose to add pages such as blank page, map page, master/details, web view, settings etc. I can’t stress enough how much of a time saver this step is.

Note that the studio also supports you in finding out which licenses the 3rd party frameworks use. For example, if you add a Settings page which uses JSON.Net for the serialization of the settings, a link to the license is added to the Summary pane on the right, and so you don’t have any surprise.

The features

The features dialog is as exciting. With one click, you can add new experiences to your application such as Suspend/Resume, Background tasks, notifications, live tiles and more.

2017-05-24_11-54-40
The features dialog

This is probably the easiest way to offer a fully featured application to your users.

Why only MVVM Light at this time?

Microsoft ran numbers of the Nuget downloads and saw a confirmation that MVVM Light is the most widely used framework to build MVVM applications on Windows. In addition, its modularity and simplicity of use makes it a prime candidate for the first version of the WTS. However this is an open source project and so the developers of other projects (such as my good friends at the Prism or MVVM Cross projects) are already working to add support for their own framework in the WTS.

What about other application types?

At the moment, the WTS only works for Universal Windows applications. However nothing would prevent it to be updated for other application types. Personally I would welcome Xamarin support! And here we can predict that this will probably happen sooner or later, supported by the community of open source developers. I can see a lot of advantages in adding support for Xamarin or even WPF desktop applications. So I encourage everyone to head to Github and start contributing!

Resources

Here are some videos and links to get started:

I hope that you also see the potential of this great tool and that you will contribute.

Happy coding!
Laurent

GalaSoft Laurent Bugnion
Laurent Bugnion (GalaSoft)
Share on Facebook
 

Live blogging the Microsoft Build keynote, day 2 #msbuild

.NET, Build, Conferences, Technical stuff, Universal Windows Platform UWP, Visual Studio, Windows 10, Work, Xamarin, XAML
No Comments

And the show continues on day 2! In this post, I will be live blogging the Microsoft Build keynote on day 2. This should be a very exciting event with focus on client development, Windows and Mixed Reality. Get ready!!

Live blogging the Microsoft Build keynote, day 1 #msbuild

.NET, Build, Conferences, HoloLens, Technical stuff, Universal Windows Platform UWP, Visual Studio, Windows 10, Work, Xamarin, XAML
No Comments

Build day 1 is a wrap and you can find all the live notes taken during the keynote in this post!

My plans for Build 2017 #msbuild

.NET, Blog, Build, Conferences, Technical stuff, Universal Windows Platform UWP, Visual Studio, Windows 10, Xamarin
No Comments

Days are passing and the time is getting closer to pack my stuff and fly to Seattle again. This will be my first trip to my third home this year, and I am really impatient to be there. I just love that place.

Getting there

I will be arriving in town on Saturday evening, quite late. My plan is to pick a rental car and get to the hotel in Pioneer Square and get to bed :) The next morning, based on experience, I will be up super early (thank you jet lag). This is a droning day! I am not 100% sure yet where I will drive but I am considering getting close to Rainier National Park if the weather is good enough. Alternatively maybe take the ferry to Bainbridge to make footage of the islands. Or maybe the Snoqualmie area. Or maybe all of the above. This will be a day like I love, driving around on my own schedule, relaxing, flying, filming, editing pictures at a cafe… Should be a lot of fun if the clouds are cooperating!

Visiting the office

Monday will be an office day. Seattle is an important hub for Valorem, and this is the office where it all started for me. I love going there and seeing the new and improved space. So as usual I will be looking forward to meet new colleagues and meet old colleagues again!

The conference: Live blogging

During the conference itself, I will try something new this year: I will be live blogging the keynotes and the sessions that I can attend. In previous years, I was always taking notes during the events and posting these notes to my blog every so often. Surprisingly, this has been quite popular, even though these are my raw notes without much commentary. I found out that not everyone can watch the live stream, and people were reading my notes and getting some of this keynote feeling there. But of course posting a blog post is a lot slower than taking the actual note. So this year I installed a new plugin on my blog called 24LiveBlog. This will allow me to publish my notes about the keynote in real time as well as hopefully post pictures too. That should be a fun exercise!

You will be able to follow the live blogs at the following URLs. However please note that these links will only be active on and after the keynote day 1 and 2 respectively!

Keynote day 1 (Wednesday May 10, 2017): http://blog.galasoft.ch/posts/?p=1601
This keynote will take place from 8AM to 11AM PST
(4PM London time, 5PM Zurich time).

Keynote day 2 (Thursday May 11, 2017): http://blog.galasoft.ch/posts/?p=1606
This keynote will take place from 8:30AM to 10AM PST
(4:30PM London time, 5:30PM Zurich time).

I am really looking forward to this exercise and hope that it will be useful to you all!

Wednesday: Mix2017 party with iHeartRadio and Valorem

Yes yes I know, the name is really significant… this is not a revival of the MIX conference! I know we all miss this amazing conference… No, the Mix2017 event is Valorem’s and iHeartRadio’s party at Build!

Join iHeartRadio and Valorem for #Mix2017, a fantastic night where music meets mixed reality. iHeartRadio’s DJ will mix your favorite music and Valorem will mix your reality with exciting HoloLens experiences on Wednesday, May 10, at the Living Computers Museum + Labs. As a bonus, event attendees get free admittance to the museum.

More details and registration on the Valorem website! I hope to see many of you at this event!

Happy coding!
Laurent

GalaSoft Laurent Bugnion
Laurent Bugnion (GalaSoft)
Share on Facebook
 

Enabling / Disabling design data in Visual Studio 2015 Update 1

.NET, Blend, MVVM, Technical stuff, Universal Windows Platform UWP, Visual Studio, Work, XAML
No Comments

If like me you use design time data in Blend or the Visual Studio designer, you may have noticed a small change that is actually very convenient, but maybe not the most discoverable feature ever: You can now switch design time data on or off very easily!

To illustrate this, follow the steps:

  • Start Visual Studio 2015 Update 1.
  • (if you have not done so already) Install MVVM Light with: Tools / Extensions and Updates / Online –> Search for mvvm light and install the extension.
  • After restarting Visual Studio, select File / New Project and create a new MvvmLight (Win10Univ) application. This will create a new Windows 10 Universal project with all the MVVM Light scaffolding.
  • Open MainPage.xaml in the Visual Studio designer (or select Design in Blend from the context menu on MainPage.xaml).
  • Make sure that you set the configuration manager to x86 (not ARM or x64).
  • Build the application.

At this point, you will see one of two images below:

2016-02-29_14-10-21

Figure 1: Design data is enabled

 2016-02-29_14-10-48

Figure 2: Design data is disabled

What’s the difference?

If you study both figures closely, you will see the difference at the bottom: Figure 1 shows actual data created in the code of the MVVM Light application (“Welcome to MVVM Light [design]” and the “Starting…” label for the Clock), while figure 2 shows the names of the databound properties (WelcomeTitle and Clock) instead. Switching from one figure to the other is done by using a new button on the design surface, which is a little hard to find. Here is an illustration:

2016-02-29_14-16-09

This small button is tooltipped “Enable Project Code”.

What this button does is enable or disable a feature that MVVM Light applications are taking advantage of: The possibility to run some of your app code while the application is loaded in the visual designer. If the button is toggled on, the design time code will be enabled, which explains why the WelcomeTitle label shows the design time text, and the Clock shows the initialization text. This is useful, because it will allow you to design your app visually without having to actually run it, and so you will be faster.

On the other hand however, design time code can crash the visual designer. This type of errors can be fixed by updating the design time data, but they are time consuming, and sometimes it is just not worth it. In those cases, you may want to disable the design time code for the current view, which can be done by toggling the small button off.

In the case where the button is disabled, you can still edit the UI somehow, because the name of the property will be shown, and you can at least set the font, font size, foreground color  etc, which is better than nothing. For lists, this works too: If the design time code is enabled, the design time elements will be shown like in figure 3. On the other hand, if you disable the design time code, three “dummy” items will be created, which allows you to edit the item template visually. Here is an example taken from an app I am currently working on.

 2016-02-29_17-30-17

In addition, it also enables some level of design work with configurations that were not initially supported by the visual designer: ARM and x64. You can verify this by changing the configuration in the MVVM Light application above. Here the toggle button becomes disabled, and the view in figure 2 is displayed.

Having the possibility to disable design time code renders the visual designer more stable by allowing the user to eliminate possible design time error from the equation, and to still use the designer even if the design time code fails. It also allows some level of designer usage even with ARM or x64 configurations. This should accelerate things especially towards the end of the project, when maintaining the design time data can be time consuming.

Happy coding
Laurent

GalaSoft Laurent Bugnion
Laurent Bugnion (GalaSoft)
Share on Facebook
 

Watch the Connect() online conference on GalaSoft.ch!

Technical stuff, Visual Studio, Website, Work
No Comments

On November 18th and 19th, you can watch the Connect() online conference streamed LIVE on http://www.galasoft.ch and also directly here on this blog article.

Read the rest of this entry »

Upcoming speaking engagements and travels!

.NET, IdentityMine, MVVM, Technical stuff, Visual Studio, Windows 10, Work, WPF, Xamarin, XAML
1 Comment

Wow it’s autumn already! When did that happen? The Summer was very busy, with a lot of super interesting work at IdentityMine, the release of MVVM Light V5.2, and preparation for an upcoming article in MSDN Magazine (more about that later) and even some work on some personal apps I wanted to port to Windows 10 and improve.

In the coming few weeks, I have some travel coming up, with speaking engagements. Here is the list below, and I will update it if something new comes up. I really hope to have a chance to see you at one of these talks, and if you do come, please come say hi and let’s chat!

Read the rest of this entry »