HACKER Q&A
📣 vanilla-almond

Are you using .NET to write cross-platform desktop or mobile apps?


Microsoft's .NET is an open-source platform for building desktop apps and mobile apps (and more) using C#, F# and Visual Basic. Does this sound too good to be true?

For example, Electron is often discussed on HN (liked and disliked), but .NET is far less discussed as a cross-platform option.

Similarly, Xamarin is a platform built on top of .NET for building Android and iOS apps (using one codebase). This sounds like the holy grail of mobile development. But what is the reality?

I did a search on HN and found no stories about Xamarin from the last year. The top search results are HN stories from 5-10 years ago. This makes me wonder how popular .NET is for cross-platform desktop or mobile apps.

What has been your experience using .NET writing cross-platform desktop and mobile apps?


  👤 thesuperbigfrog Accepted Answer ✓
You might want to consider how much Microsoft uses it in their own products before choosing to use it. This article describes the situation pretty well:

"not even Microsoft, literally the people who own Xamarin, use it in any of their big products like Teams, Outlook, and the list goes on. Instead, they reach for native development or Electron. So we can just tie a bow in it and have a minute's silence for another end-of-life cross-platform software development framework."

"None of These Problems Are Solved With MAUI. The poor developer experience, how apps look, XAML being a pain, and these other core issues won’t be resolved by MAUI. So, if you already know Xamarin Forms, and you’re waiting for MAUI to land, but you’re not 100% thrilled with the experience so far, then it’s a great opportunity to think about learning something else."

Source: https://betterprogramming.pub/xamarin-forms-is-dying-and-mau...


👤 flanbiscuit
At a previous agency job, I was on a project that was re-writing an iOS and Android app used by millions of people. We looked hard into using Xamarin for this but in the end concluded that it was not ready yet. This was in 2019.

Main reasons were:

- You can use Xamarin.Forms to write cross-platform UI, but our UI was complicated enough (a weather app with lots of custom UI) that Xamarin.Forms would not have worked for us. So we still needed to write 2 separate UI codes, which Xamarin allows for because it exposes the complete SDKs for both platforms via Xamarin.iOS and Xamarin.Android.

- Xamarin provides a way to use existing 3rd party libs written in native iOS/Android by creating "bindings". For very popular libs, the Xamarin team maintains these bindings, for others, you need to rely on open source ones. The client required us to use a bunch of third party libraries and we either couldn't find them at all, or found ones that didn't work. We needed Mapbox, Firebase analytics & Crashlytics, and some other ones... pretty well-known libraries.

We were in contact with someone at Microsoft during this exploration and even they couldn't help us. They couldn't point us to any big well-known names using Xamarin and they couldn't help us with any of the missing or broken bindings we needed.

Thankfully in the end we just split up into 2 teams and wrote the app in native iOS and Android.


👤 n8cpdx
Microsoft stopped development (more or less) around May 2020 to focus on MAUI, which was released in November 2020.

Actually it wasn’t - MAUI wasn’t released until May 2022, tooling was just released July 2022 for Windows, and VS for Mac with proper support has yet to be released. If you’re used to command line that may not seem like a big deal, but the whole point of the .NET ecosystem is that you have a rich set of tools that saves time and enhances developer productivity.

So as for why Xamarin wasn’t discussed for the last few years, it’s probably because Microsoft put it in a coma for 2 years.

I was hoping MAUI would fix a lot of the quality issues, but like any big rewrite, it seems to have traded one set of problems for another. The developer experience is better, but there are lots of bugs in basic functionality that make it difficult to use. https://github.com/dotnet/maui/labels/t%2Fbug I don’t think Microsoft has enough engineers assigned to this project to make it successful.

If you don’t care about the quality of your app (e.g. your a corporate form developer and don’t care about your users) MAUI is a great choice. But if you don’t care about the UX, web technologies are almost certainly a better choice.

As for native desktop, you’d have to be really stupid to choose WinUI or UWP, unless the point of the app is to be a WinUI or UWP demo. WPF is fine, but then why on earth would you choose that over electron or WebView2, which solves some of the resource problems from pure electron.

All of this is coming from someone whose entire career is built on .NET client technology… I was really hoping (and still hope) for a turnaround. I bet big on Xamarin being the right approach; I still think it is, but Microsoft really dropped the ball since the acquisition.


👤 tyleo
We built Rec Room (https://recroom.com/) using Unity across several platforms:

* iOS

* Android

* PC

* PlayStation

* Xbox

* VR

Rec Room is a "game for building games". I'd say Unity has worked pretty well. Given that the product is a game this success with single-lang cross platform may be more common than other industries. Still, though, I'm surprised that there isn't a similar "engine" for non-game cross platform development like Unity or Unreal that folks are generally happy with.

(Shameless plug, we are hiring if folks are interested https://recroom.com/careers)


👤 DonnyV
For cross platform framework. I would recommend Avalonia https://avaloniaui.net/ It has the flexibility and cleaner version of WPF but also lets you build it all in code if you choose like Flutter. They have a support business to support the project. So you know it will be well supported for years to come. The team is very responsive to the community also.

If I was Microsoft I would just fork Flutter and add C# support and call it a day. Flutter is really flexible for mobile and desktop and has a ton of community support with libraries.


👤 romanhn
I recently spoke with the tech lead of a team that is all in on .NET for web development, as well as using Xamarin.Forms to develop cross-platform mobile apps. While this achieved their goals, the lead felt that the complexity of dealing with platform-specific edge cases slowed them down enough that developing using native tooling would have taken the same amount of time. He would not choose Xamarin again if faced with the same choice.

👤 windows2020
I love C#.NET + Xamarin + Visual Studio.

  * Easy to get started
  * Builds for iOS on a remote Mac but runs in local emulator
  * Performant!
  * Simple to write device specific code
  * Power of .NET
  * Supports more than Android and iOS, like desktop UWP

👤 bob1029
We are on top of .NET 6 today. Been using a .NET stack for over half a decade in production.

We still just do the web app thing. For our business & customers, this is the lowest-friction way to deliver the application experience. So, we are effectively cross platform on both our client and server. We only have to maintain one code pile to make it all happen.

If you can figure out a way to make the web work for you, try it. Having an app icon on someone's phone is such a ridiculously wasteful thing to chase unless you can properly justify it.


👤 adnanc
I initially developed an iOS app (https://ayahbyayah.com) using Objective-C in 2012 (10 years on the AppStore next month)

Re-developed in Xamarin.iOS in 2016 which has been a solid decision due to the productivity gains I get from C# and Visual Studio tooling.

Xamarin.Forms works well for line of business apps and the performance with iOS was fine, however encountered a number of Android performance issues which is simply due to the nature of the framework.


👤 edimoldovan
Making a choice based on popularity of the tool might be the wrong approach. If making a choice is even needed.

If I would start something now I would most definitely go for Swift/SwiftUI and Kotlin/Jetpack Compose. I find that productivity, developer experience are best with those as soon as one gets the hand of them.

Also, these are the only ones to be guaranteed to be around long-term. While any of the cross platform options sound interesting, there is no guarantee they will be around.


👤 Kipters
Xamarin (native) used to be my go-to technology for cross-platform mobile apps, but Microsoft has absolutely driven it into the ground since the acquisition. Looks like they only care about MAUI, for which I couldn't care less given the horrible user and dev experience.

The motto for Xamarin used to be "you can do all the same stuff you can do natively, with day one support". Not anymore, and it's disheartening to see.


👤 sandreas
As a C# developer currently trying to improve my skills in UI development this HN thread is enlightening (thank you) but really demoralizing...

I noted down the following technologies to be the next thing to learn / take a look at:

  * MAUI + Blazor Hybrid (no official linux support, which usually is a no go for me)
  * AvaloniaUI (looked very promising, especially the 11 Preview1[1], although not microsoft)
  * Uno Platform (also not bad but not from Microsoft...)
I thought, it would just be a matter of "which one is the best", but it seems that all these did not come to stay or do not have official support from Microsoft (which usually means not getting widely adopted).

An AvaloniaUI example App named Camelot[2] looked good at first, but after testing this on different OSes made me think, that performance wise there is a lot of room for improvement.

So far i have given flutter a wide berth because learning a new language (Dart) AND a new framework did not seem to fit my time capacities, but what I've read here makes me think, that even writing a simple cross platform app it is not worth the effort learning another C# UI technology, because they mostly get abandoned before they really mature.

My personal conclusion: Use Flutter instead! Am I right?

[1]: https://dev.to/avalonia/turning-it-up-to-11-34jn [2]: https://github.com/IngvarX/Camelot


👤 zigzag312
For .NET cross-platform UI there are:

MS frameworks:

- MAUI (ex Xamarin.Forms) which is similar to React Native as it's controls use native widgets for rendering.

- MAUI Blazor which is similar to Electron and Tauri as it uses web view to render widgets.

- MAUI.Graphics.Controls (experimental) which is similar to Flutter as it uses Skia to render it's controls.

Non-MS frameworks:

- Avalonia

- Uno

Both Avalonia and Uno are similar to Flutter as they use Direct2D, Skia, etc for rendering. Quick comparision I just found: https://github.com/robloo/PublicDocs/blob/master/XAMLFramewo... Note, that it's already a bit outdated as Avalonia 11 is adding support for mobile and WebAssembly.

Avalonia was more focused on desktop (Windows, Linux, macOS) until recently. Android, iOS, WebAssembly is still in preview. However it does support embedded platforms, like Raspberry Pi, Torizen. It's also able to run without a desktop environment. https://dev.to/avalonia/turning-it-up-to-11-34jn

Uno I think was more focused on mobile in the beginning and expanded from there to other platforms.

All of these frameworks are build around XAML. There is some support for using C# instead of XAML, but most docs/examples are for XAML. Search 'C# Markup' for more more details.


👤 alexb_
MAUI is less cross-platform friendly than you might think. I'm using Avalonia right now, which works well.

👤 aspyct
I used to write xamarin apps for a living.

It was great, until it became terrible.

Nowadays I don't develop mobile apps anymore. Last time I checked, Xamarin Forms was half decent to build simple apps, but you have to be pretty flexible on the specs and the visual design.

Still, for data entry apps and other simple purposes, it can be fine.


👤 Crank76
You may want to take a look at Nevron Open Vision (https://www.nevron.com/products-open-vision.aspx). This is probably the most advanced desktop cross-platform application development framework around. I work for the company that created it and we have internally compared it to MAUI, Uno, Electron Qt etc. Nevron Open Vision is better in all aspects - it supports more controls, better integration and now also supports Blazor-WebAssembly! MyDraw is one commercial application built with it and tested by thousands of Windows and Mac users.

👤 stop50
Xamarin is apparently merged into .net 6as .Net.maui. i only know 1 application that is multiplatform and relative popular: keepass.

👤 ducharmdev
As a .NET developer that's focused mostly on web development (e.g. APIs + SPAs), I've not been very eager to wade into the pool of XAML that is .NET desktop/mobile frameworks.

But I'm becoming more optimistic with the introduction of Blazor Hybrid. Whether you're using MAUI for mobile & desktop, or WPF/WinForms for just desktop, Blazor Hybrid provides you a web view that enables usage of Razor components made of C#, HTML & CSS. These components run natively, not in the browser.

After using Maui + Blazor with Tailwind for styling in a recent side project, I can see this becoming a viable alternative to Electron.


👤 pjc50
I'm maintaining a cross-platform headless application at the moment. The frontend is in Java maintained by a different team. Dotnet core works pretty well for Windows/OSX/Linux.

The UI story is .. less encouraging. I'm not sure a UI that's both cross-platform and native-compatible is even possible. Microsoft have a load of offerings none of which anyone is really happy with.

I think the main way of building a cross-platform app in C# is not Xamarin but Unity...


👤 rcarmo
I had a play with it and Avalonia on Mac, Windows and Linux: https://taoofmac.com/space/blog/2021/11/14/1600

However, right now I’m actually writing a simple GUI app in Godot (the game engine), because it is the closest thing to Delphi/Lazarus that I can actually be productive in…


👤 whycombagator
As mentioned Xamarin is now MAUI[0]

The only app I know of using it is Bitwarden[1]

[0] https://docs.microsoft.com/en-us/dotnet/maui/what-is-maui

[1] https://github.com/bitwarden/mobile


👤 adamdusty
There are gui frameworks made by the community as well. Avalonia has picked up steam since it supports Linux and has been around for a while. Documentation is lacking and I can never get it to work the way I want but I suspect that's more my fault than theirs.

Uno is another cross platform C# gui framework. I gave up on C# gui apps before I ever tried it out, but it looks good.


👤 david422
You could try google's flutter: https://flutter.dev/ for cross platform. I'm currently building a sample app and seems to target and work decently well across the biggest platforms - web, mac, win, linux, ios, android.

👤 desaiguddu
IMO, You should only build on .NET platform if there are usable components which are already made in .NET.

Keeping up Cross-platform framework updated with the changing OS versions is difficult.

Preference would be to use Flutter (Google) or React Native instead of Xamarin.


👤 CyanLite2
Xamarin is now called MAUI. You'll find better search results using the MAUI term.

👤 BiteCode_dev
I don't trust the "new nice microsoft this time it's true we love FOSS and users I swear" enough to tie my stack to any of their products.

Things like VSCode, github or azur pipelines are ok because the cost of a potential migration away from them is tiny compared to the benefits they bring.

However, basing your entire code base (e.g: with .Net), dev env (e.g: codespaces) or infra (e.g: azur cloud) on their tech is betting that a company with a terrible track record will never, ever, go back to its previous bad practices.

I'm not making that bet.


👤 HideousKojima
I use Godot for cross-platfotm native apps, specifically the Mono version. Very excited for the .NET 6 version to become generally available soon.

Things have worked just fine for me, though I haven't made anything too serious with it yet.


👤 kasajian
Without third-party libraries and/or frameworks, you can't target the same desktop applications that Electron can. For instance, .NET didn't have a cross-platform desktop offering until the last few months with the introduction of MAUI, which supports both Windows and MacOS, but not Linux.

However, if you go outside of what Microsoft offers directly, there's many options, some of which do something similar to Electron. Two off the top of list is the Uno Platform and Photino. There's others. They come and go.


👤 Frontend_devs
NET and can be used to develop applications which run on Android and iOS.

👤 shrubble
Not available for FreeBSD? Not very portable across platforms, it seems.