The Modern .NET Show

Episode 95 - Avalonia UI with Dan Walmsley

Embedded Player

Episode 95 - Avalonia UI with Dan Walmsley
The .NET Core Podcast

Episode 95 - Avalonia UI with Dan Walmsley

Supporting The Show

If this episode was interesting or useful to you, please consider supporting the show with one of the above options.

Episode Transcription

Hello everyone and welcome to THE .NET Core Podcast. An award-winning podcast where we reach into the core of the .NET technology stack and, with the help of the .NET community, present you with the information that you need in order to grok the many moving parts of one of the biggest cross-platform, multi-application frameworks on the planet.

I am your host, Jamie “GaProgMan” Taylor. In this episode I talked with Dan Walmsley about Avalonia UI, a cross-platform desktop UI framework for all the .NETs which has been in development since 2014 and has the largest support for operating system and desktop environments of all the UI frameworks. We talked about why you might choose to use it over .NET Maui, and what potential roadblocks it has faced that the other cross-platform desktop UI frameworks are yet to face.

So let’s sit back, open up a terminal, type in dotnet new podcast and let the show begin.

The following is a machine transcription, as such there may be subtle errors. If you would like to help to fix this transcription, please see this GitHub repository

Jamie

Hello, Dan. My goodness, it’s great to be connected with you. We’re gonna talk about yourself and mostly about Avalonia UI and cross-platform .NET stuff in a moment. But first of all, I’d like to welcome you on to the show. Thank you ever so much for being here.

Dan

Hi, Jamie. Thanks for having me on the show is great to be here.

Jamie

Not a problem. So for just peeking behind the curtains a little bit, a little bit of inside baseball talk, this is an episode that’s taking a little bit of time to get around to but that’s because you’re a very busy, very, very busy chap. So that is totally understandable. So yeah, so I think when we first started talking, I had heard of Avalonia UI, but I I hadn’t, at that point heard of any applications that use it. But now there’s a whole bunch of people signed on, and these are actually using it in their day-to-day application stuff. So I guess, just to give the listeners a bit of a teaser there: we’ll be talking about a couple of cross-platform modern .NET apps that use Avalonia. And how you can maybe do that. But I guess before we can even start on that. I was wondering, would you mind introducing yourself to the listeners give me a little bit of a flavor of who Dan is and, and that kind of stuff?

Dan

Sure, of course.

Yeah. So I’m Dan Wamsley, and I’ve actually been involved in Avalonia. From the very beginning. That’s probably coming up to almost eight years now. My background is I actually started off as an electronic engineer. And working with electronics, the companies I worked for, they always needed software, embedded software, software tools on on the UI. So I just naturally gravitated towards programming and found out that I was actually quite good at it and really, really liked it. And I just sort of migrated into that space. After a while I discovered technologies like WPF. And started, I really enjoyed, like the patterns that we use there and developing UIs. That was obviously tied to Windows. And eventually, I kind of had like my own projects that I was building on this sort of new WPF technology. And I really wanted to run on Linux as well. Started looking on GitHub to see if there was like, you know, and Stack Overflow, you know, and there was no real solution. I discovered this one guy, Steven Kirk, had kind of done a very small reengineering of WPF. And like had like a button, you could get a button on the screen, and it would run on all three platforms and and then I just sort of like, “Hey, this is really great,” and started contributing to that.

And at that time, I was still in the beginning, I was still working in the embedded like electronic software space. I actually started using Avalonia to build like a cross-platform, C/C++ embedded software IDE, which kind of drove the early development forward, because obviously, in those early stages, it was there’s going to be a lot of problems or things that are missing. And then eventually, I was just like, you know, I really liked doing this UI stuff. Working on Avalonia and that’s pretty much all I do now. Yeah.

Jamie

I like that. There’s a lot to be said about dogfooding your own stuff. Right?

Dan

Yeah.

Jamie

And when you are the user, you discover all of these things that you don’t hear about until a “real user” starts using it. And I think that’s, that’s quite kind of important, right?

Dan

It’s, it’s invaluable to, if you’re, if you’re developing a framework or tool, and you’re not using it yourself. You know, don’t be surprised to find that users have problems that you haven’t even imagined were going to be there. And yeah, from the whole time that I’ve been working on Avalonia, including now, I’m make sure that I’m active in actual projects that are using Avalonia. So I work on both sides. And that way, you immediately see if there are issues, and the advantages, you know, you can just dive in there, as anyone can because it’s open source, you can just dive in there and fix it yourself. Or there’s a huge community of experts that, you know, if it’s something that’s not your expertise, there’s people you can rely on, talk to you, and they’ll tell you how you can fix it. And that’s the way that I’ve worked with Avalonia. Now, well, the whole time.

Jamie

That’s cool. I like that. And then, like you say, dogfooding - using your own software to achieve some goal - is the best way, I think, as we both said, to learn about the software to learn about the domain. I remember working on some invoicing software for a company I used to work for, and they were selling it to their clients sort of thing. And the problem was that we were under the impression that it would only ever be used for GBP payments. So you know, payments in British pounds. And then we found six months after we’ve released it, someone had whiteboxed that and sold it to a company in Europe, and then sold it to a company in Saudi Arabia. And I don’t know whether you’ve had much experience of all of the different currencies, but they’re not all based 100, right.

So like in GBP, we have 100 pence makes a pound; in Euros, you have 100 cents makes a Euro; in US Dollars, 100 cents makes a dollar. But there are some currencies like Japanese Yen that don’t have that base value, they just have the equivalent of one Euro, right, they don’t have a 100th of a Euro or a 100th of a dollar in the way that we do in Europe and the US and the UK. And so it meant that we had to go and re-architect the entire application to use, like a base value and then a modifier. So it would be instead of it being 199 in Euros, it would be 199 and the base unit cents. And then a multiplier to work it out in like the that sort of upper level unit. And if we hadn’t have had that knowledge that the … if we’d have had that knowledge rather, that the user would have been from different countries, we could have built in tests and used it ourselves to sort of fake bill companies in different regions. But we didn’t know that right? Because we weren’t dogfooding it.

Dan

Yeah, we one of the core contributors that we have, Benedict. He has worked. He’s had a PR that has completed birthdays. And it’s for text layout, right to left text support. So basically, it can support any language in the world, the complexities of rendering that and dealing with the different ways that different languages is kind of a similar problem. And that’s why that PR has completed birthdays. We actually merged yesterday, I think. So we hope we will celebrate in that but.

Jamie

Excellent. So because of the time cast pod machine wibbly wobbly-ness. That’s multiple months ago now. Yeah, so congratulations on getting that sorted. My goodness.

Dan

And they’ve had a lot of people from different countries that speak different languages you know, given us input on what works for them and what doesn’t. And, you know, it’s just, you can’t, no one person can experience or have that experience. The world’s too big.

Jamie

Absolutely. So that’s why dogfooding and things like diversity and inclusion and things like that are all so vitally important, because then you get these points of view, like you say, you know, these, these folks are like, “Hey, we’re from a right to left rather than left or right culture. And so, you know, there’s a problem with that,” or, you know, maybe, “oh, there’s this edge case with this particular unicode character,” or maybe you’re not even using Unicode? I don’t know, I’ve not looked into the code, right? And so you get all of these complexities that you wouldn’t have realized had you only lived in your little bubble and created the framework, right. And that’s what I think is really great about sort of the open source movement recently is just like, everyone can get involved. And everyone can share their experience, right?

Dan

Yeah, definitely. In Avalonia, we’ve actually got a Russian language chat group. And they, it, it’s huge. It’s like as big as the English speaking group. And obviously, when I look in there, I can’t actually understand anything that is going on, but then they’ll come and they’ll contribute pull requests in English. And it’s like, related to internationalization for Russian and similar stuff. And just, yeah, having people from all over the world is, it’s amazing.

Jamie

That’s awesome.

Okay. So we talked a little bit about Avalonia and how it’s sort of evolved over the last number of years. Haven’t really talked about what Avalonia UI actually is. I’d be interested to, if you know it, the story of the name, but also like, what is it that I can do with Avalonia UI? So yeah, so my question, I guess is, where does the name come from? If you know that story, and what is it that Avalonia UI lets me do?

Dan

Yeah, so I’ll just quickly tell you what Avalonia is. And then I’ll tell you the story about the name as it’s quite interesting. So Avalonia is a .NET UI framework. It’s cross-platform. And our kind of motto is, “your application everywhere.”

The name comes from WPF, Windows Presentation Framework. In the early days before that was actually launched. Microsoft’s codename for WPF was Avalon, Project Avalon. And our name Avalonia is kind of a nod to that. Because we see our, our roots come from to BPF. We, were kind of like, if WPF evolved, and it was written now, many years later, with the latest versions of C# and all the new .NET cross-platform technology, what might WPF look like? So that’s why it’s Avalonia it seems a bit weird at first, but when you hear the story, you can see why. where the name comes from.

Jamie

Excellent. Okay, so since it’s based on WPF, is it XAML? Is it C#? Is it some other thing? What’s the code, I guess, the sits in? How do I make a thing?

Dan

Okay, so Avalonia is all those things. WPF was very focused on XAML. A lot of people are kind of allergic to XAML. I mean, my first experience with XAML was a bit like that, “wow, very verbose,” and kind of prefer code. Eventually grew on me, actually. But yeah, in the very early stages of Avalonia, we actually just didn’t have XAML. And we supported writing a UI with code. We now have community projects that allow an enable declarative C# to declare your UI. And many people prefer to go down this route. But we actually also do have excellent support for XAML. We’ve actually written our own XAML compiler. People inside Microsoft have actually tried it out and tried to use it to optimize some of their XAML compilers and taken ideas from it. And the so it’s really up to you what you prefer, if you want to stay with code, or you’d like XAML, then go for it.

And another community project that is spun off is Avalonia.FuncUI, which is an F# flavor of Avalonia. So you’ve got all the F#, declarative, functional ways of dealing with UI and I think its MVP pattern that’s very popular now. So yeah, Avalonia is for everyone.

Jamie

Ace, ace.

There was something that you said there about, you have this, your own custom compiler for XAML stuff, and how some of the folks at Microsoft have taken a look and maybe borrowed some ideas. I love that because that, you see, that’s what I love about cross-platform, open source stuff. Especially if it’s open source, you can actually take a look and go, “that’s a really neat idea, I’ll have to maybe look into re-implementing or borrowing or whatever forking that, and doing something with it.” And then all of my customers, all of my clients, all of my users - whatever noun you choose to use - then get the benefit of the sharing of that knowledge. Right?

There’s an earlier episode, where we talked with one of the folks behind RyuJinx. RyuJinx is a Nintendo Switch emulator. And they said that one of the things that they loved doing was reporting back to Microsoft, “hey, in these particular circumstances, we’d love to be able to declare that we don’t want the compiler stepping in and doing some pre optimizations, because we’ve already optimized.” And guess what? That’s now in - I mean, this was years ago, right - but that’s in the .NET compiler now. So you can actually apply these declarative, these attributes and say, “don’t bother JITing this, don’t bother optimizing this, because I’ve already done the hard work for you. And you’ll waste time doing stuff.” So like, on entry into a method, one of the things that the .NET compiler can do, if you let it, is zeros are any new variables you create. So if you do var x default(int) - like default into whatever - it’ll create that bucket of memory for you, and then zero it out. But if you don’t care about the zero’d out value, and you’re immediately going to assign a value to it, that’s from somewhere else, that’s a wasted couple of cycles. And in things like video games, those couple of cycles, are the make or break between 60 frames a second and 55 or 40 frames a second, right.

But the great thing about that is, and the reason I bring that up is because then that’s something everyone benefits from and from what you were saying there if people at Microsoft have taken your, this XAML compiler that you’ve all worked on, and implemented some of those features to make their XAML compilers better. Well, guess what? Your WPF applications have just benefited from this free open source thing that has got nothing to do with actually the code and the framework that you’re using. But these ideas have sort of cross pollinated and I absolutely love that.

Dan

Yeah, in the in the end, I’m not sure they actually use our compiler directly, but they definitely played around with it. So probably some of our ideas have may have influenced them. But yeah, Avalonia we try to build everything in a modular way. So the XAMLcompiler isn’t in the main repo, it’s separate. So if you need that anybody can use it. And we’re really happy for anybody in the same space or anybody in the .NET to reuse our code, however they want, that there’s sometimes there’s people that use parts of our code for things that we couldn’t even think of, you know, so yeah, it’s really great.

Jamie

That, like I say, That’s it. Like I say, that’s that, to me, is what open source development is about: it’s about someone seeing these lumps of code, these individual modules of code, these individual sort of child repos, I guess, and going, “wouldn’t it be great if I could take that and actually apply it to this other problem that I’ve got,” right. You mentioned earlier on that you’re having some problems with some WPF stuff right at the beginning, before you even sort of jumped on the Avalonia. UI idea. And you were like, “there must be a way to solve this”. Well, guess what you’ve done back then what people will be doing now looking for this solution, right?

Dan

Yeah. And that’s, that’s the great thing about like, the open source world, and things like GitHub is, you know, that there could be three or four people in the world having the same problem that you’re having right now. Or the same idea. But now with with get her social media, where there’s developers, so it’s easy to find, or it’s easier to find those people. You can get those few people together that may never have found each other before. They might have done five of their own projects. But having those five people come together and making one better project is yeah, it’s incredible.

Jamie

Absolutely. And not just that, it’s within three or four hops, right? Whereas previously may have been possible to bring those people together, but you would have to know email addresses phone Numbers, whatever. But right now, if everyone’s on Twitter, you just put out a call on Twitter a, is everyone having problems with this, then immediately the people who reply, you have a way of contacting them. Right? You’ve already got a little group straightaway. So it’s like, it’s not just that you can is that you can with very few steps involved. And that I think, is amazing. Excellent. Okay. So, okay, so you’ve got this this UI framework, right? And you’ve, you’ve mentioned that it runs with .NET, several times. And the problem that I have a feel like it’s more of a marketing problem. From from Microsoft’s point of view, and I say this, right, we’re recording this during the 20th anniversary of .NET. And it’ll be going out a while later. But the the problem that I found with a lot of people with .NET, is they’re like, Okay, what does .NET actually meet? root cause is .NET framework with a capital F? There’s .NET. Core. There’s i Five, six, and you know, this year seven, next year eight. So when you say that it is a .NET. UI framework is that .NET framework, capital F, is that modern? .NET? So that’s .NET, core five, six plus, is it both? Is it neither? Like, if I’m building an app, do I need to target a specific I think they call them platform monikers. Like how can I how can I use Avalonia? UI my app do any to rewrite it is what I’m saying.

Dan

So if you’re starting a brand new application, definitely go for .NET. Six, or whatever the latest .NET core version is. We’ve built Avalonia to run on all the .NET, the traditional .NET framework .NET core, we support running under mano. All the ones that I that I know about maybe there’s some other ones that haven’t heard about. We support running, running those like the Avalonia library. Targets .NET standard. So anything that you can reference .NET standard, you can you can run.

Jamie

Excellent. Excellent. Because that’s so my I mean, this isn’t a problem for you and I to solve, right. But my biggest worry when I talk about .NET framework is I don’t want to say legacy .NET. But that’s almost kind of what it’s become right? I don’t want to call it that. Because I don’t want people to come to this and go Well, yeah. Jamie, this weirdo in the UK says that his legacy, right. And so now I have to go. But that’s not what I’m going for. Right is not legacy. It’s just, that’s why I say .NET framework with a capital F and modern .NET. Right, because it’s, it feels like there’s a bit of a separation there on what I can do. But I like the idea that you’ve targeted .NET standard. So then essentially, you’ve got the widest possible surface area for adoption. I really like that.

Dan

Yeah, so Well, Avalonia is really suited to line of business applications. There’s a lot of companies that have like internal tools just for managing various various things that they that they that they need. And many of those are either WinForms or WPF. And if you’ve got those is based on WPF, your application is going to be .NET framework with a capital F. And so Avalonia absolutely must support. Support that so that you don’t have to do any specific migration to do to bring it across. So yeah.

Jamie

Excellent, because I know that the modern .NET stuff .NET core .NET, five .NET, six different versions of the Mad X, like added support for the different like when UI and WinForms, and all that kind of stuff on a Windows only. But I guess the difference here that we haven’t really talked about touched on that much. So far. What I’m trying to do is introduce each of these things individually to the listener, right. The thing that we haven’t touched on so far is that Avalonia UI is cross-platform, right?

Dan

Yeah, that’s right. So first of all, Avalonia. If you’re building a Windows, only application Avalonia is still great. It’s a really good option for modernizing an existing WPF application. So just because Avalonia is primarily cross-platform doesn’t mean you should, you should still have a look at it and see if it meets your needs. It may be a good option for you even if it’s Windows only. However Avalonia the problem that it was first created for was to solve the cross-platform UI framework problem. And when we started, there was not really many options in a space. If you were primarily a mobile application, you had Xamarin, which is a great platform. If you needed a cross-platform desktop application, you were, it was really difficult at that time, eight years ago, to find anything, you would have to go to more native toolkits, things like that. Avalonia, it’s cross-platform, and that there’s various different types of cross-platform UI framework. So it’s almost like there’s a spectrum of different types. And depending on what your application is, and the types of users that you have, you would decide to pick different frameworks. And what they’re the place where Avalonia fits in, is we are, I always call it a luckless framework, there’s no there’s no actual default theme or look and feel. It does come with with one other box, but it’s completely customizable. So Avalonia renders all its own controls, you can make them look or style them, however you want. And this is really great for a lot of modern apps. If you take like Slack, for example, Slack, I think most people use the app or have used it and familiar with it. That application looks the same on Linux, on Mac, on Windows. And that’s a very popular option for many types of applications. For some people, that will be what they want, they will want a native view UI. You know, so they’ll want a macro as looking but and when it’s running on Mac, and they’ll want a windows looking button when it’s on Windows. And that’s great. It’s it depends on your needs. Avalonia fits more of that type of application where you want the same look exactly the same on all platforms. And a good example of this is we’ve worked with a company that have a very popular source control tool. And they have a team that’s divided into three parts. So they’ve got a few developers that work just on the Linux version, or the Linux part of the UI, then they got a few developers that work just on the Mac version, they’ve got a few developers that work just on the Windows version. Now, whenever they had to add a new feature, they got to get the all the three teams to implement that feature, they may have a problem on the Linux version or the Mac version, which means that now they got to go back to the drawing board and, and then change that. So it’s very, very, unless you’ve got many, many, many developers, it can be kind of counterproductive to build your app in that way. For some people, that will be the wave way forward. But for others, this is where Avalonia can really save time. So this particular team that I’m talking about, they’ve adopted Avalonia, they’ve gradually ported their application piece by piece to Avalonia. And now the whole team all works together, and they just implement the feature once. So they, they, they I was speaking with him the other day, and they were saying, hey, you know, we’ve had these features that we’ve wanted to implement for on the backlog for several years now. And we haven’t been able to do it because it’ll be will take too long. And we’ve started on that now. So they’re able to, to move forward. And that’s really the power of Avalonia. That’s what, what it can do for you.

Jamie

That’s, you see that? I love that giving the developers and the designers the ability to work almost at the speed of thought, right? Because that’s, that’s what you want, right? It’s not quite the speed of thought. But you know, I always go back to when I was playing around with a WinForms, back in 2006. And it was a case of drag a button, double click the button, and all of the wiring up of setting up events and all that kind of stuff is done for you. Right? And I love that I’m wary of using the word productivity, right? Because my worry is that people get off productivity that’s like combat and all these you know all these Agile and Scrum and all the other buzzword bingo but it’s actually getting stuff done. Right Drag, I mean, I’m not sure whether Avalonia UI is a drag and drop sort of thing. But I feel like it would be if it’s based on the ideas of WPF. But like, just being able to just really quickly get a bunch of people together and say, right, okay, this is the new framework, once you’ve learned, it doesn’t matter where you’re running, it just works, and it looks the same. And that I absolutely love that, because like I say, it feels like you’re handing back the power to work out the speed of thought, or the speed of creativity, right?

Dan

Yeah, sure. If you have to every feature you want to implement, if you’ve got to think, three different UI concepts, and, you know, it’s, it’s three times the amount of thinking, you’ve got to do three times the amount of designing that you’ve got to do three times the amount of testing, and then the maintenance. So you know, it just kind of grows exponentially. And then you know, a couple years down the line, you might want to support mobile. So now you’ve had an extra, an extra team on there. So yeah. And Avalonia is, it started off as desktop. So it’s, it’s kind of, if you’ve got like a high fidelity, content creating app, maybe like, you know, something like, you want to do a 2d drawing up, that there’s a team that I’ve made this program called lunacy. It’s like, icons eight.com/lunacy. And it’s a tool, bit like figma, it’s for doing like 2d designs, it’s got all these like toolboxes all around that like a canvas, and you can zoom in and out. And they’ve built that arm Avalonia super fast. You know, if your application needs to do like any kind of working with text editing, or code editing, that’s what I mean by like high fidelity, it needs a lot of controls, it needs to look great, but it needs a lot of controls, it needs to give the user a lot of control. Avalonia has, in my opinion, the the best solution right now, and the open source .NET UI space for that kind of application. Although Avalonia, we do have support for mobile backends. That kind of at the the beta stage. If you’re a mobile first application, you might consider Xamarin that’s gonna be that’s gonna cover you more right now. And we do have people that share code between Xamarin and Avalonia. So we like to work together with all the frameworks like we coexist in harmony with most of the others and and although we are going, we are hoping to improve our mobile targets to get them production ready. I mean, some people are actually using iOS, iPad, and phone with Avalonia in production. Right now, we’re hoping to improve that later. So you know, if you take Xamarin, Maui, they come from a mobile framework. And now they’re adding on to try and get that to desktop. And I think for some applications, that’s going to work, we’re great. If you are primarily a mobile application, your application may be it, it may not be one of those high fidelity content creation apps, so that’s going to see fine. But if you are one of those, those kind of desktop first applications and you might need a Mobile Companion. I think Avalonia then becomes a very viable option for to consider.

Jamie

So there’s a couple of things that I want to I want to sort of circle back to and sort of expand upon that you mentioned there. And that’s it. So it’s working on the desktops are user plural there, because we’ve got windows, we’ve got mac, and this is the easiest one to say, the Linux, right? As a as a Linux on the desktop user. I know that there isn’t like on Windows, you draw a window by saying Windows draw me a window, Windows takes care of it all. On Mac OS, you say Hey, Mac OS, draw me a window and then takes care of it. On Linux, there’s like 12 different layers between you as the developer and a window being used. That’s me over emphasizing a whole bunch of stuff. But imagine it’s like two or three, three layers, right? You’re going to a Windows Server, which just talks to the different hardware and says take this input and send it over here as a message to that window. And then you’ve got a desktop environment, and then maybe you’ve got a compositor and then maybe you’ve got like the theme of the the UI that It’s being used on that. So actually just drawing a window, and hopefully you can everybody goes there is not that easy on a Linux system because there isn’t a Linux system, right? Unless you’re going with a server side stuff. But even then, Linux itself being the kernel is kind of useless by itself or it requires all the cruft around it to actually make it work. And so I just want to take a moment. And actually, if you can, if you can share any knowledge on this, like, the fact that it runs on the Linux is, is a huge achievement to me, regardless of whether it’s WPF, or not all, regardless of whether it uses XAML or not, regardless of whether it uses .NET, or not making something that is cross-platform across many different Linux, desktop environments, and all those different bits that can swap out I think, is a huge achievement and something that I suppose most Windows and Mac Unix users, which again, and something I suppose that most Windows and Mac users won’t really appreciate too well. Like off the top of my head, I can think of those kinome those Katie, there’s X FC, and then there’s a bunch of offshoots. And then you’ve got whether it uses exe, or whether it uses Wayland and all the other things, right. And so just having that one thing that shows a window on all of those different and you can swap them out as well. All right, I’ve got a I’ve got a Papa Wes machine, which runs on a cosmic which is system 76 is on Window Manager, our desktop environment, it used to use Genau. And I can literally when I’m logged in, I can say install X FC, then reboot, and it’s running X FC. Right? But then presumably Avalonia UI just still works with all of that cruft underneath it swapped over it.

Dan

Yeah, so we’ve had a very long experience with Linux and, and story, and it’s, over the eight years Avalonia has been in development, we have pretty much tried almost certainly all the major Linux distributions that you can think of. And then obviously, the community is so big that everybody’s tried pretty much absolutely everything. And whenever there’s been a problem, we’ve never failed to get it to run on any Linux Linux distribution. And we’ve learned the pitfalls and mistakes that you can make. Doing that over the years. I think I’ll be confident to say that Avalonia is probably the most Linux compatible UI framework right now. We can support Linux, with absolutely no desktop environment, just running in a frame buffer. In fact, it’s really easy to set up I tried it the other day, and it doesn’t take long we there’s some instructions on our, on our GitHub somewhere that that are actually there’s some instructions on the documentation that you can find to do that. But it will run inside the frame buffer with GPU acceleration or not GPU accelerated if, depending on if it’s available. So like, you know, those raspberry Raspberry Pi’s, it runs really great on those if you’re into that kind of thing. And then, on all of the, the other major desktops and Avalonia gives you an API that says, give me a window, you can be assured that if we’ve put an API in Avalonia, like give me a window, then it will do that on all platforms that you run that support Windows, we’re not going you’re not going to set a property or train API. And then have one of your customers run it at runtime and it go, oh, not supported exception. And then your customer goes, Hey, you know, this, this bet doesn’t work. Oh, yeah, that’s because that feature isn’t compatible. Now, we our API’s are cross-platform. So sometimes we’ll people from the community will say, Oh, hey, we’re really interested in a feature to do this. And we go, okay, let us think about how this would work on any platform. Because obviously, Linux works in a different way to Mac and Windows. And then you might want to consider, should that API work on mobile or Linux? And that’s what that’s what we’ve become very good at doing over the years is how you make an API that’s cross-platform. And it’s one of the reasons that we’ve chosen to kind of diverge from web So we’re not like 100%, we’re very close to WPF. If you had WPF experience, you’d be very, very familiar. It’s not going to take you any time to start using Avalonia. But where we’ve changed our API’s or made them different, it’s usually to resolve that cross-platform. Story. It’s not. You can’t put a Windows that an API that’s designed for Windows and make it work on Linux, or that well, you can, but it’s kind of like trying to fit the square peg in the round hole, you know, that kind of thing. So we design all the API’s from the beginning, thinking about all the platforms, sometimes that takes us a bit longer, but it’s definitely worth it in the end. And, yeah, that’s the reason why I believe I can confidently say that we are the most Linux compatible framework. And if you do, run, try Avalonia and run it on whichever distribution you have, and you have problems, let me know. And we will make sure we resolve that very, very quickly.

Jamie

Do you think that’s, that’s one of the potential issues, I think that the .NET Maui team are going to have read? So my understanding and this is based on public knowledge, right? My understanding is that .NET Maui is like a is going to be Xamarin Forms. 2.0. Right. And my understanding is that for now, and this is this is information from our saying it, we’re recording this on Feb second, 2022. Right. And so this is information that I that I have up to this point, that is public information. My understanding is that it’s going to target Windows and Mac and Android and iOS, because it uses Xamarin Forms, right? And those are platforms that are supported by Xamarin Forms, and that there’s going to be a would you like Linux support? And if there’s enough yeses, then they’ll start engineering it. So there will. So then there are cross-platform interfaces that individuals can come in and say, oh, cool, I know how to draw a button on GTK, which is what good gnome uses. So I will add the code to draw a button that for the class which implements the interface, I draw a button or whatever read for the for .NET Maui. And I feel like that’s gonna be a problem that the. So I feel like that’s going to be a problem that the the Microsoft engineers hit in that, like you said, Windows is different to Mac is different to Android is different to iOS is different to all of the Linux is. And so I feel like, perhaps they’re going to have to, and this is conjecture, my own opinion, I’m not a Microsoft employee, you’re not a Microsoft employee, my feeling is that they’re going to have to maybe rethink that going forward to adopt a style similar to yourselves where it’s like, how would we give this? How would this API work, if it’s on a Windows, if it’s on a Mac, if it’s on a granola, if it’s on an XFC? If it’s on an Android, and then figure out like you said, the best way to present that API to the developer and say, you want a button, just call this method. And we’ll take care of it for you. So you don’t have to pass it in, because I still remember playing around with. I think it was just prior to WinForms. There was like, when you wanted a window on Windows, you had to say, give me a handle, like a W handle and pass a no, no, no, no, no, no, seven. No, no, no. 25 No, no, true. And no one seemed to know what all of the rules are for. But you need this do that to be able to get a window, right?

Dan

Yeah, well, I mean, in deep in the code of Avalonia we happen to do work with those old wind 32 API’s, you know. And that’s kind of got an interesting backstory that there’s programs that were written in, like the 80s those API’s, but technically, you can still compile them. But yeah, they, we, we’ve had to kind of work out work around all this, like intricacies of the framework. There’s, there’s weird things that can happen like, Oh, if you set this flag with with, with this flag, somebody can go it’s totally wrong. And you know, we’ve had to work through all of that, but But yeah, you, you don’t have to worry about that kind of stuff anymore. Yeah, so So on to what you were saying about the, like Maui, that’s, that’s up and coming. Avalonia is very mature level. It supports Linux. In fact, there’s like a small spin off company from Avalonia Neither, they actually give professional support for Linux if you are so needed. And the core team and the community is fully behind supporting that. So Linux is like fundamental out of the box. It’s like our priority platform. And we’ve proven that we can support those, those platforms. In fact, for over a year, now we’ve maintained a stable API, we actually have continuous integration tools that actually enforce the API, if somebody opens a pull request, and it breaks one of the API’s. It fails, it can’t be merged. So we’ve, we’ve ensured that we’ve proven that we can maintain a stable API and that our API works. cross-platform.

Jamie

So you’ve you’ve you’ve mentioned, so far that you can do all of these desktop applications, you have mentioned that there are real world applications out there that run using Avalonia UI. Now, I know from a previous discussion I’ve had with someone on the show that the application dot purple runs with Avalonia UI. There was a discussion when we were talking about it about migrating over to Avalonia UI. And there’s another person behind it. Michael Bobby Anchorman said, Hey, you should talk to these people. Because there’s this. There’s a UI framework that is amazing, should talk about. And you know, he was so excited because his quite literally Windows, Linux and Mac desktop app was running with that. Now, I don’t know whether it’s still running Avalonia UI ops up, but they, but there are a couple of others. Like you’d mentioned, there is an application that I’m pretty sure, it’s plastic SCM. But what I’m getting at is that there are a bunch of really big applications that run it right. And it’s not just like, I mean, there’s nothing wrong with just having a desktop application that just is someone’s pet project. But what I mean is really large projects, right? And I believe, and this may be old information, and it’s definitely all information by the time people listen to it. But there’s something about JetBrains are using it too. Is that still the case?

Dan

Yes. So yeah, Avalonia is, if you look at our website, you’ll see we’ve got like the company logos of people that have adopted Avalonia for major applications. i I’ll talk about the ones that have made public announcements so that I, I know that I’m safe to to talk. So yeah, there’s plastic SCM, which I was probably hinting up early on. This is like a real major, big application. They they’ve put it to Avalonia. And believe me, they’ve tried, they tried all the different options before selecting Avalonia. And the fact that they’ve, they’ve actually recently released, I think they’re, I think they’ve got like a beta testing release out now. But if you look on their Twitter, they have posted screenshots of their application. And if you look on our website, we’ve actually got their application up there, you can see, you know, these are really big, complicated code bases that have been brought over to Avalonia. And on JetBrains. So JetBrains have some tools, dot trace dot memory. These are the ones that I know of, but they may have others. And those tools are developer tools for .NET. Developers, they are really, really good tools. If you’ve ever got a memory leak, or, or something like that. It’s really easy to help you find find memory leaks and debugging tools. And because they obviously weren’t .NET core became a thing and .NET was going cross-platform and open source. Their tools now need to have you eyes cross-platform. And they I know that the current release of memory and dock trees has Avalonia UI in there. I haven’t heard anything yet. If they’re fully cross-platform yet. Maybe that’s announcement may be coming soon. But because JetBrains actually started adopting Avalonia for their for their own tools. They wanted to have the very best developer experience for Avalonia for their developers, and obviously they have the rider ID it’s not free but if you do run an open source project or your student they do give you free licenses they’re really good at I think you just emailed them and they pretty much sorted out within a day. And and if you’d like An independent developer, it’s it’s not so expensive. And the quality of the right ID, which actually runs Linux, Mac, Windows is superb. It is my go to IDE, I still use Visual Studio, I still love Visual Studio. But the for developing Avalonia applications, the integration that they have done there is incredible, you know, you can actually do like refactoring inside the XAML. It’s got a live previewer that, that it just works better than, than anywhere. So yeah, they they’ve upgraded their tools to make Avalonia work, the best, it could could work in an IDE primarily for their own for their own reasons, because they’ve adopted it. But yeah, there’s other applications that you can see there. On our website, there’s one called wasabi wallet, which is like a Bitcoin wallet. And they’ve got a really nice modern UI, there’s a screenshot on our website, we’ve got the lunacy, which has a very impressive 2d design application. I’m aware of other people developing like CAD applications where you’ve got 3d, integrated in the in the middle of the screen, and then all the 2d menus and buttons and tools to work with CAD around the edge. And then even people are using Avalonia in like ways that like, if they have a plug in that goes in an existing CAD tool, but they’ve rendered like the plugin in, in Avalonia. But there’s this, there’s many, many big companies that you can see from our website like JetBrains. Like the plastic SCM, there’s like big industrial partners that are developing, and using Avalonia on very, very low powered, like embedded systems that go in

kind of industrial environments, like, I don’t know, maybe nuclear power plants or something like that. But because they’ve got involved, they need Avalonia to work on those tiny, tiny systems. That means that they’ve actually put resources into Avalonia to optimize it to make it still perform well on these with you know, processes that are very, very limited. And the RAM is limited, that make the Raspberry Pi look like, you know, like a supercomputer basically. So that they can get Avalonia to run more simple you eyes but on those with like touchscreens and, and that kind of thing. So yeah, like Avalonia is proven. And you can see that because it has been chosen by by those kind of major people. To give you an idea, as well as the size of our community. Our documentation, I checked today, and by the time the podcast goes out, it will undoubtably be more because every every month, this number is just going up and up and up. But this month, it’s 180,000 visits to the documentation, which is kind of an indication of people who are actually using Avalonia. So and it’s growing all the time. Yeah.

Jamie

That’s Yes. That’s great. That’s, that’s amazing to me, just like the because how do I put it as an unintentional ignorance right? Before last year, I hadn’t heard of Avalonia UI, but then I’m not working in the cross-platform desktop UI space. So that’s why I likely haven’t heard of it because I’m, you know, most of my stuff is micro services and web based on just get a couple more hits on the SEO keyword thing, right? You said blockchain, I said microservices were good, right. But um, but the fact that the after these eight years of development, you’re starting to speed up and ramp up really quickly with big, big people big names coming in, but also obviously smaller projects coming in. And I’m not trying to compare the size of a project, but just like the ability to run, like you said, either on a Korean credibly constrained hardware that, like you say, is maybe a microcontroller and a couple, I don’t know, a couple 100 megabytes of RAM, I’m just guessing, right? All the way up to something that’s running on the desktop. So we’ve we’ve actually talked to plastic SCM in the past, and just the work that they’re doing it because it is a source control management system, right? The work that you’re that they’re doing to display all of that is just mad, right? And the fact that you can do that in Avalonia UI, I guess effectively for free across all the different desktops is is, is an amazing achievement, I think. And then you add to that, I mean, you’d said to me, when we did so inside baseball, we do a discovery call, have a bit of a chat about the technology behind, you said to me how there is very, very, very emphasize that one more time very experimental behavior for putting your app inside of the browser as well. So like, this constant innovation, it’s so amazing stuff.

Dan

Yeah, so with, with targeting the browser and web assembly, we actually held off from diving into there. And immediately, we’ve kept an eye on what’s been happening in that space. We wanted to wait for web assembly .NET, on web assembly to mature a little bit. And we feel now that with the release of .NET, six that that has happened, it’s still not perfect. But what that has enabled us to do is very recently is add a support for Avalonia apps in the web browser. And I’m not going to say it’s production ready, because Avalonia, we are very, very, very careful to say if something’s production ready, we, we want you to use Avalonia, in your first experience to be like, hey, this just works. And it works really well. We we, we don’t want to like, Well, we actually don’t do any marketing, everything’s pretty much word of mouth, but we don’t want to like over market something that’s, that’s not ready. Because that’s just gonna be a bad impression. And then you know, you, you will, you’ll tell other people, hey, just didn’t work and, and then you wouldn’t consider us even for desktop. So we have launched, there’s a Avalonia dot web package that you can use, and we’ve got .NET templates that you can just get. And if you’ve, if you’re comfortable with something that might be rough around the edges, a lot of people in the community are so excited about it, they’ve already started building applications on to run in the browser using Avalonia. We’ve got a few demos which I’ll share links with you to put in the description or something and, and you can actually just run it in the in the browser today. And it looks really, really good. It’s only like down to only a few megabytes, download and, and okay, that is WebAssembly, the performance is always going to be less than running natively on the desktop. But in my opinion for the kind of applications that you need to do. Right now, it’s a pretty good level. And well, we hope it’s going to get better going forward. And yeah, so it’s it’s kind of an exciting time, it’s not ready for production yet. But if you’d like to experiment with that, some of the people that already are already contributing fixes and, and the bits where it’s rough around the edges, they’re there, they’re helping to get it ready, and any of your listeners can very welcome to come and help us out and join in.

Jamie

So that’s the interesting thing for me, right? Like I said earlier on, I’m not in the desktop UI space anymore. But like, I feel like the majority of the .NET developers that I know, do web based stuff. And so a lot of like when .NET core was first released, there was a big push to just do just do web, just do web, it’s easy to do, just do what, wrap everything up in electron and do it that way. Right? Because that was seen as an easy way to do it, right? So a lot of the people that I know, in the .NET development space will be coming at desktop UI for me web perspective. And so that nice little switch around if actually, no you need to do on desktop will be kind of maybe a little jarring to them, because desktop development is a little different to web development. Because first of all, you still have that separation, you still want the back and forward separation, the back end of the front end the server and the client. But the difference will be that instead of saying send this information over the web and wait for the response, it’s more a case of fire up a delegate or some kind of thread and go do it and wait for the response. Right? So the implementation details are slightly different. But the ideas are still the same. Then like that, that you’re at this position where you’re able to go hey, why don’t we make this very experimental thing where we can actually use the web paradigm and see whether we can do That way, I like that because it’s like, it’s like you maybe maybe you’ve identified that there is a, a position in the in the space to say, hey, let’s, let’s allow these other developers into our ecosystem, and show them how cool it is. Right? So I just wanted to say that because I think that’s a, it’s a really cool thing you’ve done.

Dan

Yeah. And, and one thing is that that’s kind of really surprised me with adding the support for Web assembly, is that when I first did it, I just thought I was adding just another platform to Avalonia. And but it’s kind of strange, like the the possibilities that it’s opened up is like, every day I come in against, I’m coming, I’m finding like a new way that it can be used. So there’s a guy called V Slav in our community is very active. And he’s always building like, really great tools. Like he’s got some cool 2d is one of his projects. That’s like a 2d drawing project. And the other day just said, Oh, hey, how about this web assembly demo that he’d done. And it’s like, you’ve got Avalonia edit on the left, which is like a full featured syntax highlighted code editor with XAML. There. And then on the right, it’s just, it’s the Avalonia UI that the XAML produces in the browser, you can just change this ammo in the browser. So you can just play with Avalonia now in the in the browser. And it’s like, I didn’t even think that that that was gonna happen. And then, so I was talking to somebody the other day, and they were like, Hey, there’s loads of like, tools that we could just have on the website or on GitHub that actually run on WebAssembly. Like, all the resources that show you what other colors are, and you could search through them and stuff. And it’s like, Oh, yeah. And icons, oh, we’ve made it let them search for like built in icons, or things like this. And then we can have like live demos on the, on the website. And then, like, even we were starting to work with some component vendors that have like, pro controls and charting and things like that. And they, they may have like versions for WPF. But you would have to like download the demo to try it out. And some people may do that. And then but like now, you could just have the demo right there in the website next to the marketing material, whatever, the people can control it straight away. And it’s like, yeah, I wasn’t even thinking that all these kind of ideas can be can be done when I was was implementing that I was just starting with adding another platform. But it’s like mind boggling the the scenarios that this leads to, so yeah, I kind of got bitten by the WebAssembly. Bug.

Jamie

I like it, because that sort of goes back to the idea circles back to that idea of, of dogfooding. Right? You know, like you said that, right? You, you’ve got this application by one of the one of the contributors who’s like, here’s the XAML, for drawing the screen. And here’s the screen, and you can like you were saying you can edit it in line, and watch it update in almost real time. You know that that gives you a chance to maybe like you say you can try it out. Or even you could debug it, right? Let’s say I’m a computer and I don’t have my, my ID, I don’t have any software, but I’ve got access to source control. I’ve got access to this app that’s sitting on the website, I can copy, paste it in and play around with it. And then I can say, right, it’s not the greatest. Don’t ever do this, folks. Don’t ever go to GitHub and submit a change or commit directly from the UI. But you can say, Oh, of course, I fix this now copy paste back in submit effects that are done, right. You don’t even have to have you could do I can I can imagine a situation where you could be sat on the train, commuting into work, and you’re on your phone looking at the code going, why doesn’t this work? I’ll copy paste that into the live viewer that’s on the Avalonia UI website. Oh, of course, I’ve missed a semicolon or a Mr. close bracket, copy, paste that back into source control and fixed before you even get to work.

Dan

Yeah, and GitHub as the new Code Spaces is like when you’re on GitHub, you just press the full stop button on your keyboard. And it just gives you a version of Visual Studio Code in your browser with all the code from the repo or ready to go and you can just edit it. And the contributor that I mentioned, viz love that did this. He tweeted out a tweet the other day with a screenshot and it was like his Avalonia application in GitHub Code Spaces and running anti buggy, because it’s all running on web assembly says like, it’s just like crazy what’s going on?

Jamie

Yeah, it really is. Okay. So here’s the difficult question to answer then right? We talked about Avalonia. history, we’ve talked about what it can do how you can do it. So, and without wanting to sound confrontational? Why should I choose? Avalonia? Right? What’s what’s so great about Avalonia? Give me like a sales pitch and an elevator pitch for why I should use Avalonia for my next desktop, or indeed, when it’s stable web web application.

Dan

Sure, so first thing I’ll say is that as an engineer, you should look at all the options and decide which is the best option for the project that you’re working on. And if you don’t look at all the options, then you might not get the best results. So keep that in mind, you should try all of them work out what best best for you and your project or your team. And choose the best one. That’s the best way to go about this. But I’ll give you some reasons why Avalonia may be a good choice for for you. And first and foremost is Avalonia is independent. Were a open source community. We’re a very welcoming community, we’re welcome everyone. If you find an issue or a bug, there’ll be somebody in the community that responds to you. You can get that fixed, you can get that merged, you can work with us, we’ll help you out, somebody in the community will help you out. So you get the fear, you get to feel part of something. Because of that. I think I’ve touched on before that we’re over eight years in the space. So that’s probably the longest time to any of the current cross-platform XAML based or dot .NET, core based UI frameworks have been around. And also, for over a year, we’ve enforced stable API. So you can depend on Avalonia. API, again, Linux is officially supported, and always will be. Which something that you might find difficult to find with other platforms. And as we mentioned before, this, were a technology that you can depend on. And that’s proven because you can see the big names that I’ve selected Avalonia. And they wouldn’t have done that if Avalonia hadn’t done its homework. And it wasn’t their platform that I say it is. Don’t trust me, though, have a look for yourself, all the code is there, try it out. Yeah, and there’s, there’s many of the example applications, they’re in the wins, some of them are in the Windows Store and the Apple Store. So they’ve got through certifications to get into the the community is really exponentially growing. People are joining everyday into the chart and into the discussions and into the issue. So Avalonia is not really we’re not going anywhere, we’re going to be here for you that the core team of developers, most of us have left our jobs and we work full time on Avalonia or Avalonia related stuff. And we’ve basically pretty much dedicated our working lives to Avalonia. And we’re not going we’re not going anywhere. So you don’t need to worry about if Avalonia will still be here in four years time or five years time. And as I say we’ve spun off a small company that allows commercial entities that are using Avalonia to to get paid support, or help porting their applications. And we’ve done that primarily to first of all make it viable for us to work on Avalonia full time it’s the focus is on the community. So the community is the is Avalonia but by doing that, it means that we are able to financially support ourselves whilst fully giving the best support we can and improving and working on Avalonia all the time and bringing up to date and adding all these exciting new platforms like web assembly and features and making sure that it the quality will remain number one and at the top and it will be dependable. So that those are many reasons I can think of that you may want to choose. But as I said, again, it’s not for me to tell you which platform to choose, try them or find out which one you like the best. And that’s one of the other platforms. That’s great. If it’s Avalonia. Get in touch with me, I’ll help you out. I’ll point you in the right directions, or somebody else in the community will do. Everybody’s welcome.

Jamie

Awesome. Okay. So I guess then, I guess, where’s the best place for people to go to find out about Avalonia? Right, so I’m guessing Avalonia? dot whatever. Right? Is that? Is it a website? Is it GitHub? Is it? Is there a documentation website? Is it reached out to you what what’s the best place to learn about Avalonia?

Dan

Sure, if you’re a developer, have a look on our GitHub documentation DockStar Avalonia, UI .NET. If you run a team of developers, and you’re interested in Avalonia, have a look at our website Avalonia. UI .NET. Anyone really, if you want to come and talk to us, we’ve got a really active community on telegram. It’s t.me, forward slash Avalonia. And people are always welcome to answer any questions, technical or non technical. Just just pop in there. Most of us are there pretty much 24 hours anyway. So there’s always about 40 or 50 people online at any one time.

Jamie

Excellent stuff. Okay. That I mean, so what I’ll say is, we’ve got all of those links in the documentation, we used to do the episode. So don’t worry about diving over your dashboard to grab a pen to write them down. Right? And so that’s fine. Right? So yeah, so we’ve got all those in the in the show notes. So if you’re, if you’re driving around, or if you’re on a, you know, you’re going for a run, or you’re working out at the gym, or you’re doing the dishes or whatever, don’t worry about dashing across the room to grab your phone to go to the website. They’re all in the show notes, or do do check the show notes. They’ll that will be the show notes in your device and on the website as well. So they’re in both places. So you don’t have to go verify it’s like one hop to get to that information. Like we said earlier on one off to bring people together. But yeah, so what I like to say then, as we wrap up is, thank you so much for being on the show and talking about Avalonia UI, I’ve legitimately learned a whole bunch about how difficult it is to create cross-platform UIs. And the applications which run on those cross-platform UIs. And I’m genuinely blown away by the fact that you can do desktop, scissors. Mobiles is and the new very experimental, not very stable, don’t use it for production, web stuff, as well. So it’s like, it’s almost like it’s one platform to rule them all trademark anatomy.

Dan

Yet, it’s taken us a long time to get to this to this point where it needs people of various different skills. And luckily for the community, those people have all come together and make this happen. And yeah, it’s it’s a lot of work, though. It is a lot of work.

Jamie

Excellent. And yeah, so all that work is I’m afraid of using the term coming home to roost, but you know what I mean, right? It’s all paying off, right? And so like I said, Dan, thank you so much for being on the show. I really appreciate it.

Dan

Yeah, that’s really great. Thanks for having me on.

Jamie

No worries.

The above is a machine transcription, as such there may be subtle errors. If you would like to help to fix this transcription, please see this GitHub repository

Wrapping Up

That was my interview with Dan Walmsley about Avalonia UI. Be sure to check out the show notes for a bunch of links to some of the stuff that we covered, and full transcription of the interview. The show notes, as always, can be found at dotnetcore.show, and there will be a link directly to them in your podcatcher.

And don’t forget to spread the word, leave a rating or review on your podcatcher of choice - head over to dotnetcore.show/subscribe for ways to do that - reach out via our contact page, and to come back next time for more .NET goodness.

I will see you again real soon. See you later folks.

Follow the show

You can find the show on any of these places