Another long title for a relatively short article.
In case you aren’t aware, the az cli has a great extension for Azure DevOps and supports automatically logging you in to the devops extension when you use az login. Very helpful and simple, no need to manually issue a PAT through the Azure DevOps portal.
Now, what about the scenario when you need a PAT to make a rest call to Azure DevOps? There are some scenarios that the devops az cli extension does not cover (such as queuing a yaml pipeline with parameters).
Here is a quick and easy PowerShell script to get you a PAT:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Note that there is not much documentation on using this mechanism with the az cli. I was able to work this out due to my previous experience obtaining an Azure Databricks token using the same command.
Long enough title? It might be longer than the actual article content.
If you need to queue a yaml pipeline in Azure DevOps from a script, you may be tempted to use the az cli and the devops extension. The extension is useful, but has some bugs/gaps I would recommend using it in combination with the Azure DevOps REST API.
This DOES NOT work:
az pipelines run --organization "https://dev.azure.com/organization/" `
--project "project" `
--name "Pipeline" `
--open `
--variables foo=bar --debug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I updated the samples and snippets to include some reader feedback:
Accounted for Master-Detail navigation in App.PromptToConfirmExit
Provided a toast + back button confirmation alternative sample
Updated sample: allow toggling between Master-Detail and Tabbed navigation; allow toggling between dialog and toast confirmation styles.
Overview
Ever hit the navigation bar back button when using an Android app and have it fully exit the app and drop you back on your home screen? I think all Android users have encountered this a few times. It is a frustrating and counter-productive experience. Let’s make sure your app has better UX by using a simple confirmation dialog!
Good news, this is easy to implement and should only take you a few minutes to code and test.
Step 1
Create a property to check if there are pages on your navigation stack. Here’s my implementation:
Step 2
Override the OnBackPressed method in your app’s MainActivity to intercept back navigation. Here’s a sample:
Inspired by Steven Thewissen’s excellent MSAL article, I thought I would share what I have learned about MSAL over the 3+ years I have worked with MSAL and Xamarin. If you’re just getting started, be sure to read Steven’s article, he does a great job covering how to use the tools. This article is a collection of my personal learnings and experience using MSAL in my apps.
Without further ado, here are 6 tips/tricks/facts about MSAL, AAD B2C and Xamarin:
TIP: Careful with package upgrades!
I cannot emphasize how important this is, check out the older packages in nuget: https://www.nuget.org/packages/Microsoft.Identity.Client/ the library was in preview for nearly 3 years and I went through the pain of dealing with api changes and behaviour changes. Read the change log carefully!
FACT: You cannot change the Android webview title from “Sign In” without a custom MSAL build.
This is roughly what I have used in my last few projects, not exact, I generally use dependency injection and a few other bits. For simplicity’s sake this is a self-contained sample implementation. I would advise using Lazy<T> for IPublicClientApplication at the very least in a real life application.
TLDR: The Experimental Mobile Blazor Bindings can result in much less XAML and C#, 64% less in my experiment, but the tech isn’t quite ready for prime time.
First off, Blazor is a new technology within ASP.NET Core which allows rich web applications to be written with C# instead of javascript (for the mostpart). My intent here isn’t to explain Blazor, if you wish to learn more, check out the resources listed at the end of this article.
Blazor uses the ASP.NET Razor template engine to deliver html content to browser clients. Html is markup, Xaml is markup…why not use the Razor engine to build Xamarin?
That’s the question Eilon Lipton answered with Mobile Blazor Bindings. In essence, this approach uses Razor syntax with Xamarin Forms Xaml to create mobile apps.
You may find yourself wondering why you should care…as I did when this was announced. I’m not a massive fan of Razor pages and lately I’m finding myself frustrated with the huge amount of Xaml code required to do some relatively simple things in Xamarin Forms. The Mobile Blazor Bindings approach doesn’t really solve the Razor pages issue, but it certainly helps simplify Xaml and at the same time, it also helps simplify your C# by using a binding which doesn’t rely on INotifyPropertyChanged.
I was not excited about this approach until I actually saw the results. There is huge upside and promise, I’m looking forward to seeing where this goes. No having to worry about INotifyPropertyChanged, no commanding, far more flexibility in Xaml with the tried and true Razor engine.
On the other side, I ran into 3 relatively major issues.
OnClick methods would only fire once
An IsVisible flag set by a variable wasn’t working at all
iOS wouldn’t work (I didn’t look very close at this).
Note: these issues are all fixed in the Preview 2 update!
There is also no hot reload support at this point, which you miss very fast after getting used to it.
Great job by Eilon Lipton and everyone else from the Xamarin and Blazor teams who brought this experiment to life!
I generally use Xamarin Forms to build apps. I’m currently working on a new project and using all the new greatness from Prism. One of those great features is Xaml Navigation. This is a fancy markup extension which allows you to navigate to another page in your app without implementing anything in your view models! It’s super terse and it works with xaml hot reload!
All the Toronto Xamarin Saturday 2019 sessions can be seen on YouTube!
David Ortinau opened the morning and afternoon, everyone was in the main room for these talks. The morning topic was Comet, a new Xamarin based MVU UI Toolkit being developed by the Xamarin team and primarily led by James Clancey. I see a bright future for Comet! (More to come on this in a future post…)
The group then split off, with the majority watching the lectures in the main room while Daniel Causer and I led a Xamarin 101 Workshop in another area. In the end, we helped 15 developers build their first mobile app and release it through App Center!
Andrew Park and Emily Stanek worked hard coordinating the event and to keep the stream going and interact with the online participants. The TO Mobile Devs organizers worked tirelessly leading up to the event, trying to get as much done with as little cash as possible. Thanks BSI Labs for funding the food, stickers, prizes and providing the venue!
Our speakers graciously dedicated time, effort and their own funds to get to Toronto, stay in hotels, etc. I cannot thank everyone enough.
In case you haven’t heard, the Toronto Mobile .NET Developers group is hosting a full-day session, Xamarin Saturday, on August 24th at BSI Labs. Whether you are totally new to Xamarin or are an experienced Xamarin expert, we will have something for everyone!
I am often more irritated than pleased by Apple’s announcements. The notch, features that have been in Android for years being lauded as a revolutionary innovation, dropping the headphone jack…I could go on, but it would be exhausting for both of us. I think it’s important to know what I think about Apple before I move on to discussing this new TestFlight feature.
I believe TestFlight Screenshot Feedback will end up being one of the most important announcements Apple has made in the past 5 years.
What is it?
Here’s a quick demo of the new TestFlight Feedback using RateTheMeet:
Feedback is available to developers almost instantly through App Store Connect.
Testers can now send feedback directly from your beta app simply by taking a screenshot and share detailed feedback with a crash report immediately after a crash occurs. TestFlight 2.3 and iOS 13 beta or later are required. You can view and manage tester feedback in App Store Connect. Visit your app’s TestFlight page and click Crashes or Screenshots in the Feedback section in the left side navigation. You can filter your feedback view by build numbers, app versions, devices, iOS versions, or tester groups. For details on how testers submit feedback, see Testing Apps with TestFlight. For details on viewing and managing tester feedback, see View tester feedback.
Why is it important?
I hope you immediately see why I’m excited about this feature. Managing feedback from users is never a simple task. Since there was no first party flow for collecting feedback on iOS or Android, this was always some sort of custom process. Whether you would do this using a third party tool or an ad-hoc flow like email or an issue tracking system, it would be a hassle for both users and developers to manage feedback.
A first party flow from Apple means that Google Play will likely work to add similar functionality in the near future. It also means I will be driving the majority of my testing through App Store connect and recommending my clients do the same.
Providing an out-of-the-box first party solution for managing feedback will help increase app quality and reduce time spent implementing third-party solutions or handling cumbersome manual feedback mechanisms. Kudos to Apple for leading the way on this important ecosystem improvement!
Since Microsoft purchased Xamarin and ended Xamarin Evolve, there’s been a void in the community. There has been no conference for us to gather, network, learn, share and grow. That was the void Dan Siegel was aiming to fill when he created the @XamDevSummit account and sent out this tweet back in January:
People have been asking for Xamarin Evolve… well get ready for the next best thing. You might want to call it Evolve Redux… we call it the Xamarin Developer Summit. Coming to Houston in July 2019. Be sure to follow us for more updates. #XamDevSummit2019
Since founding the Toronto Mobile .NET Developers Group back in May of 2017, I have had the pleasure of interacting with the local Xamarin community. You may not have that luxury. Xamarin Developer Summit would be a great opportunity to interact with mobile developers, build friendships, collaborate and explore ideas.
Houston: Space City
In addition to all the fantastic opportunities of the conference, I’m also looking forward to checking out Houston! I’ll be aiming to get to Space Center Houston as soon as I get a chance. I’m also going to be eating as much local food as possible: chicken-fried steak, Texas BBQ and crawfish!