Live data from Hacker News

Writing GUI apps for Windows is painful

tulach.cc

361–370 of 577 posts

Re: Writing GUI apps for Windows is painful

#361

Earlier quoted context omitted.

.NET since 6 (I think) can be published as a self contained app with the runtime included. It immediately adds some size to the output but you can mitigate it with AOT and trimming.

AOT is currently only available in CLI apps. It's expected for WinUI 3 apps using WASDK v1.6 closer to the end of the year.

Oops, I googled it and you’re right.

Re: Writing GUI apps for Windows is painful

#362
> Problem: When linking dynamically, there are a myriad of different .dlls required to run the app, totaling over 40MB.

Is 40MB a lot nowadays? Eg the argocd cli is 155MB, and that's just a relatively simple cli app that as far as I know just calls a remote api.

Welcome to bloatworld I guess.

Re: Writing GUI apps for Windows is painful

#363
post #268

Earlier quoted context omitted.

Which particular .NET Gui? There is a collection of them: MAUI, WPF, Blazor Hybrid, WinUI. Microsoft have utterly screwed the pooch on getting their .NET GUI story straight.

WinUI 3 is the default for Windows-only applications

Nah, it is so bad, that on BUILD 2024, they have brought back first level status to WPF.

No one burned with WinRT history since Windows 8, is ever touching WinUI, unless they are Microsoft employees on WinDev, or companies with sunken costs trying to keep their products around.

Re: Writing GUI apps for Windows is painful

#364

Earlier quoted context omitted.

WinUI3 is a can of worms that’s becoming palatable only with .NET 8 (and soon 9). In a normal configuration, you have to bring 500MB of dependencies with you, or ask the user to install a redistributable. You also need the user to install .NET 8, or bring said 0.5GB with you. WinUI3 can be used in unpackaged apps (I.e.: not appx) but has a few random caveats that just don’t work; random APIs that have a footnote of “…

What kind of build settings lead to 500 MiB binaries? I struggle to imagine something that could make the toolchain to emit such a large binary save for select degenerate cases of runaway generic specialization when you AOT compile an SDK that combines LINQ with 2102718201 enum types, all of which get their own set of generic instantiations for every internal iterator within LINQ - that's a known issue that is fixed…

You should browse the set of WinUI related repos, YouTube community calls and Developer Connection, feedback is something they aren't short of.

Re: Writing GUI apps for Windows is painful

#365

Earlier quoted context omitted.

It’s just because the WinUI3 libraries and/or .NET Core runtime take that much. Mostly WinUI3 IIRC. And that’s when you use “selfcontained mode” rather than AOT publishing, now with AOT it’s considerably better.

Self-contained/single-file mode is compatible with trimming and benefits from the work done to improve AOT story. As AOT binaries get smaller and ILLink's analysis gets smarter, the single-file trimmed binaries will see a part of such improvements. The issue is that many GUI frameworks are not AOT-incompatible per se but rather trim-incompatible as they rely on reflection that is done in a way that is totally opaque…

If only UWP had a AOT compilation story for .NET code that could be re-used for WinUI 3.0....

And then there is the whole C# / C++ interop between CsWinRT and C++/WinRT.

Re: Writing GUI apps for Windows is painful

#366

Earlier quoted context omitted.

Agreed. I had the exact same question. From the article: "The issue is that with bundling the .dll, it would still mean it being extracted somewhere and writing additional code for the P/Invoke to work, and C++/CLI gets compiled to .NET IL code, in other words, you can open the resulting app in dnSpy and see the C++ code translated to C# equivalent (which is not what I want, I want native code)." I don't understand w…

C++/CLI is managed code, it’s basically C++ compiled into .NET IL. If you’re writing C++ code running on .NET / .NET Framework, you’re basically writing masochistic C#.

Actually I find it much easier to write C++/CLI, than getting right all P/Invoke marshaling, specially if COM is also part of the picture.

Also C++/CLI can also generate native code when specific code patters are used, that is why there are some compiler flags to disable it, and such assemblies are considered unsafe.

Re: Writing GUI apps for Windows is painful

#367

Earlier quoted context omitted.

WPF has been superseded (supposedly) by UWP / WinGUI / MAUI / Blazor?

UWP was designed primarily for Windows phones, usability on desktops suffers. And it requires windows store, you can’t just ship an installer .exe WinUI seems to be copy-pasted from UWP, same usability issues on desktops. Unlike UWP, it’s a mess in terms of software quality. Also the runtime is huge, I think the size in MB even exceeds Electron. About MAUI, it seems Microsoft decided to make an abstraction over nativ…

MAUI is basically Xamarin.Forms, rebranded and rewritten, thus forcing the whole Xamarin community to rewrite their stuff, or go elsewhere.

Miguel de Icaza is pretty sour on this, and quite likely one of the reasons he is now fully into Apple ecosystem and Swift.

Blazor started with being only a WebAssembly based framework, then they decided to put everthing on ASP.NET under Blazor umbrella, and are now pushing Blazor into everything that has a Webview, including the stupid idea of Hybrid Blazor in MAUI, basically Electron in .NET.

Re: Writing GUI apps for Windows is painful

#369

Earlier quoted context omitted.

.NET since 6 (I think) can be published as a self contained app with the runtime included. It immediately adds some size to the output but you can mitigate it with AOT and trimming.

AOT is currently only available in CLI apps. It's expected for WinUI 3 apps using WASDK v1.6 closer to the end of the year.

Not limited to CLI (even at release in .NET 7 it was possible to use it with ASP.NET Core with limitations and there were custom templates to make it work with some GUI framework I think, and MonoGame already worked partially), certainly not in .NET 8. I’m not sure about WinUI 3 itself, but a lot of things today are AOT compatible.

And naturally single-file + trimmed works almost everywhere, in some situations requiring to add attribute annotations for un-analyzable reflection usage patterns.

Re: Writing GUI apps for Windows is painful

#370

I'm teaching myself the Win32 API for a future RE project, thinking that knowing it helps with the reverse engineering effort. I have just achieved creating a window, loading a text file and printing it on the main window. Scrollbars are there but don't work yet. It actually take s a lot of work. The boilerplate code is OK but I never realized that showing strings on Windows is such a PIA. I have deep respect for any…

That book is worth gold from Windows game development archeology point of view, it is quite hard to find anything related to WinG online.
Post reply on HN