What’s New for Xamarin Developers in Visual Studio 2019 version 16.5 Preview
This week, Visual Studio 2019 version 16.5 Preview 2 was released, bringing several new features and improvements for mobile developers in Visual Studio to help you build better mobile apps, faster.
Visual Studio 2019 version 16.5 Preview 2 Release Highlights
- Xamarin Hot Restart: Test changes made to your app, including multi-file code edits, resources, and references. While also using a much faster build and deploy cycle. With Hot Restart, debug your iOS app built with Xamarin.Forms on a device connected to your Windows machine. This allows for a much faster inner development loop.
- Android Apply Changes: Quickly see changes made to your Android resource files. Such as layouts, drawables, etc., on an Android device or emulator without requiring the application to be restarted.
- Faster Android Startup: Generate your own custom profiles using startup tracing in your Android application. Providing improved application start-up with a minimal increase in app size.
- XAML Document Outline: See the hierarchy of your Xamarin.Forms UI in the “Document Outline” pane.
Faster Iteration with Xamarin Hot Restart
When running your app, your C# code is compiled and used, along with your other project resources, to build an app bundle. That bundle is then deployed to your emulator, simulator, or device. Incremental builds help reduce the compilation time. However, deployments generally take the same amount of time regardless the size of the edit.
Xamarin Hot Restart works by pushing new changes to the existing app bundle when possible. Which vastly reduces the deployment time. It also supports changes to code files, resources, and references. So, whether you are editing your view models or swapping image resources, Hot Restart lets you quickly push the changes to a device or emulator. There is no project configuration required, so Hot Restart fits in easily and enhances your existing workflow. Additionally, when debugging your app, you can edit your C# code and press the restart button to apply the changes. Your app is automatically restarted so you can now test the new changes.
With Hot Restart you can debug your iOS app built with Xamarin.Forms on a device connected to your Windows machine. Allowing for a much faster inner development loop. Seeing this affect with the SmartHotel360 application. Their first builds are 69% faster, while incremental builds are 81% faster:
|Initial Build||Initial Deploy||Incremental Build||Incremental Deploy|
|w/o Hot Restart||172.7s||26.2s||37.2s||14.4s|
Thanks to the thousands of Xamarin developers who gave us feedback during the private preview phase! Xamarin Hot Restart is now available in Visual Studio 2019 version 16.5. See our Hot Restart documentation for information on how to get started.
Android Apply Changes
In our effort to examine how we can make Android developers more productive, we looked at the most common edit types. After discussion with developers like you, we found that Android resources, as well as layouts and drawables, made up a significant portion of edits. In this release, we are introducing support for Android Apply Changes! Enabling you to make resource changes at runtime without having to restart your application – even during a debug session.
Get started with Apply Changes today! With a new toolbar icon that will apply your Android resource changes to any connected device or emulator.
Android Start-Up Performance
In a previous release, we had released a feature known as startup tracing. In which you use a default profile to improve the startup performance of your Android applications with a minimal increase to APK size.
This release, we are including MSBuild support for supporting custom profiles within startup tracing. So you can record your own custom profile based on your application’s needs at startup time. The generated profile can then be used instead of a default profile. Resulting in improved startup performance to an additional 40%, with a minimal increase to your APK size. For example, here is a table below against the Smart Hotel 360 sample application:
|Release||+ AOT||+ Start-Up Tracing||+ Custom Start-Up Tracing|
Get started with custom startup tracing by following the start-up tracing documentation.
XAML Document Outline
Xamarin.Forms developers already have access to a plethora of tooling to help build UIs faster. UIs such as XAML Hot Reload, control toolbox, and property panel. In addition to a powerful editing experience with IntelliSense. Our goal is to provide a delightful mix of design-time (such as toolbox, property panel, editor) and run-time (such as XAML Hot Reload) tooling to make building Xamarin.Forms UIs productive.
The Visual Studio 2019 version 16.5 Preview 2 release brings the Visual Studio Document Outline feature to XAML. Enabling you to see a hierarchy of your Xamarin.Forms UI in the Document Outline pane:
Open the document outline with Ctrl+Alt+T or via View > Other Windows > Document Outline.
Even more from Visual Studio 2019 version 16.5 Preview 2!
That’s just a small peek at what’s available in Visual Studio 2019 version 16.5 previews. It also includes smaller additions, such as bug and performance fixes. As well as updates to the project templates to feature CollectionView, and improved editing for Android XML constructs. For a complete overview of all that is available, check out the release notes.
Try everything mentioned above today! Download the Visual Studio preview, which can be installed side-by-side with your stable Visual Studio environment:
Microsoft is directly driven by your feedback, which means Visual Studio 2019 is full of features that were inspired by YOU! From XAML Hot Reload to faster Android build and deployment times. Make your voice heard by filing bug reports or sharing feature suggestions on Developer Community.