When writing code in C# you get a lot of help from the language and IDEs keeping you from making a bunch of kinds of mistakes. Type safety stops a lot of potential bugs from making it past the Compile step. The refactoring support for C# is pretty slick as well. Move code around, rename stuff, change namespaces, and it all gets sorted out quickly.
But when working in XAML, that’s mostly gone. There isn’t a lot of checking that happens during the build, even with XAML compilation turned on. Bugs in XAML end up getting debugged at runtime. This means a much slower bug fix process than an equivalent bug in C# would have. Some of these bugs end up causing crashes, so they’re pretty easy to spot once you run your app and get to the right page. Others, like mistyping identifier names in Bindings, can just silently fail.
XamRight aims to solve these issues. It gives you those little squiggly lines to tell you something’s wrong while editing your Xamarin.Forms XAML. Install it, and it’ll start doing its thing. It keeps working in the background, and you can have it analyze your entire project to make sure everything is clean before you commit your changes.
To install the XamRight extension, go to the Tools menu of your Visual Studio 2015 or 2017 IDE. Choose the “Extensions and Updates” option in the drop down. A dialog listing available extensions should pop-up. Search for “XamRight” in the search bar and click install.
After Visual Studio restarts, your 30 day free trial for XamRight will start. You will be informed when your trial is about to expire. You can purchase a subscription at xamright.com and a license will be emailed to you
Please note: the XamRight extension will use the network for the following purposes:
Talk to the license server
Anonymized telemetry reporting
To activate your license, go to the Tools menu and choose “Options” in the drop down. The following dialog should popup. Select XamRight > Licensing and enter the information required.
Under Tools > Options > XamRight, the General section gives the ability to customize how you use XamRight.
Normally this should be checked. XamRight is designed to be low overhead, and disabling it will result in no error detection, either in real-time or using the Build command. However, if there is a problem, or you just want to remember what it was like without XamRight, you can temporarily disable it from here.
Display inefficient layout warnings
If this option is enabled, XamRight displays warnings that may not necessarily cause a crash or UI error but may result in slower runtime of your app due to extraneous XAML elements.
For instance, in most cases, a StackLayout with a single child will have no impact on the resulting layout, but will result in a slower layout cycle. XamRight will warn about this situation (and others) if the “Display inefficient layout warnings” option is enabled.
Do aggressive view model detection
XamRight is able to employ more aggressive analysis techniques to match Views to their View Models in cases where less conventional View to View Model setups are used. In some cases, these techniques can cause incorrect mappings to be inferred, resulting in incorrect warnings. If you are finding a significant number of incorrect Binding warnings from XamRight, try disabling this option.
XamRight catches XAML bugs that otherwise only get caught at runtime. Unlike C#, XAML does not have as much Intellisense or compiler checking during the build, even with XAML Compilation turned on.
XamRight analyzes XAML pages as soon as they are opened, and will incrementally scan them as you edit, giving you live feedback on your code. Perform a full scan of your Xamarin solution by selecting the Build > Analyze Solution with XamRight.
XamRight was developed to recognize a wide variety of ways that view models are associated with views. Whether you use an MVVM framework or manage your view models and views, XamRight has the most powerful analyzer for understanding Xaml MVVM code.
All XamRight features are built on top of that powerful analysis engine, including diagnosing Binding errors, providing completions in Xaml, and now creation of new properties in view model classes. When you put that all together, XamRight helps you write effective Xaml, regardless of how you want to work.
XamRight, layout, warnings, making, option, these, runtime, Tools, result, should, model, license, cases, incorrect, slower, pretty, models, kinds, bunch, Studio, XamRight, layout, warnings, making, option, pretty, cases, runtime, these, slower, Tools, model, license, should, incorrect, result, editing, models, disabling, error