News for hackers. Stuff that matters.
Re:Building a bare-metal bootable game for Raspberry Pi in C# by andsoitis on Monday December 11, 2023 @09:09AM (#38600746)
I haven't programmed against .net in almost 15 years so it was cool to see where the ecosystem is today:

* latest version is 8.0, released Nov 2023

* cross-platform: Windows, macOS (incl. ARM64), and Linux

* can not only target desktop (Windows & macOS) and server, but also WASM, Android, iOS

* used in game development (Unity, Godot, MonoGame, Stride, FlatRedBall, Everyone, CryEngine, Unigine)

* can target embedded development ("IoT")

* developer tools (Visual Studio) that works across Windows, macOS, and Linux

(source: https://dotnet.microsoft.com/en-us/)

Re:Building a bare-metal bootable game for Raspberry Pi in C# by bad_user on Monday December 11, 2023 @10:03AM (#38601237)
WASM, Android, and iOS targeting is subpar, though. For multi-platform client-side targeting, Kotlin is actually more interesting.

.NET was always built for showmanship, with somewhat disappointing results when actually tried.

Re:Building a bare-metal bootable game for Raspberry Pi in C# by superfist on Monday December 11, 2023 @10:58AM (#38601698)
You have either outdated info or outdated experience
Re:Building a bare-metal bootable game for Raspberry Pi in C# by jayd16 on Monday December 11, 2023 @10:57AM (#38601690)
What makes kotlin more interesting besides the first class Android support?
Re:Building a bare-metal bootable game for Raspberry Pi in C# by bad_user on Monday December 11, 2023 @11:30AM (#38602008)
The latest Kotlin can target WasmGC. WasmGC became enabled by default, quite recently, in both Chrome and Firefox:

https://developer.chrome.com/blog/wasmgc/

Kotlin's support is in Alpha right now, but works well, and it's one of the first language implementations that can target WasmGC:

https://blog.jetbrains.com/kotlin/2023/12/kotlin-for-webasse...

By comparison, .NET's Blazor targets LLVM, and they either AOT or JIT, however the client has to download a heavier runtime that has at least a garbage collector (nevermind the JIT), and is less than ideal. Basically, the original Wasm was designed for languages with linear memory and still makes a great target for C++ or Rust, but not for managed languages like Kotlin/Java. dotNET's WASM is there only to support Blazor, which is a web framework, a sort of successor to Web Forms and whose future is uncertain. Speaking of which, you're better off with MVC + HTMX, but I digress. So for more interesting use cases, Kotlin is actually ahead in their Wasm support.

For multi-platform support, the company behind it has a vested interest in targeting multiple platforms, and Kotlin Multi-platform support also has Google backing. So, for one, you can share business logic on iOS, as you can integrate Kotlin libraries into Swift applications:

https://kotlinlang.org/docs/multiplatform.html

And they have been porting Jetpack Compose to the desktop and to iOS (and can be used with Wasm in the browser, too):

https://github.com/JetBrains/compose-multiplatform

Also, see this year's keynote at KotlinConf:

https://www.youtube.com/watch?v=c4f4SCEYA5Q&t=2903s

Over on dotNET side, the blessed solution by Microsoft, for targeting iOS, Android, or the desktop, is right now .NET MAUI. So, where's Xamarin? Where's Silverlight for that matter? That's right, Microsoft changes multi-platform solutions like they change socks, and I don't understand how anyone could trust them for a multi-platform solution.

Re:Building a bare-metal bootable game for Raspberry Pi in C# by unusualmonkey on Monday December 11, 2023 @12:41PM (#38602703)
Seems strong to say .net is mostly showmanship... when your main contention is another framework has alpha support for a different GC.
Re:Building a bare-metal bootable game for Raspberry Pi in C# by neonsunset on Monday December 11, 2023 @11:40AM (#38602092)
WasmGC is a prototype that only supports the bare minimum that is enough for languages with high level constructs only but not for something like C# which has interior object pointers (ref) and uses them heavily for performance (spans are built on top of them).

The API of WasmGC is really rudimentary.

With that said, you can track support of various WASM features by .NET here: https://github.com/dotnet/runtime/issues/94351

I don’t understand how the logic of your post works however, WASM in .NET is already used in production versus something that is an early alpha? Also, on Kotlin and targeting something that is not Android - “Java Interop” that’s all I need to say.

Re:Building a bare-metal bootable game for Raspberry Pi in C# by wiseowise on Monday December 11, 2023 @12:15PM (#38602404)
What’s wrong with Java interop?
Re:Building a bare-metal bootable game for Raspberry Pi in C# by mihular on Monday December 11, 2023 @12:05PM (#38602324)
MAUI is rebranded Forms and while MS is pushing it, it's by far the only way to build an Android UI. You can build it natively, sort of like since the beginning. While still supported, Xamarin transitioned quite nicely into .NET where can take all of the advantages. And you get a good reply about WasmGC in the other post. Also .NET is ahead when it comes to cross platform UI compared to Kotlin - there are libraries such as Avalonia, Uno and others. And so on and so forth.
Re:Building a bare-metal bootable game for Raspberry Pi in C# by naavis on Monday December 11, 2023 @01:59PM (#38603910)
How have I missed Uno! I was familiar with Avalonia, but first time hearing about Uno. I'd love to see more UI frameworks for .NET that also work on Linux.
Re:Building a bare-metal bootable game for Raspberry Pi in C# by WillPostForFood on Monday December 11, 2023 @02:23PM (#38604239)
it's by far the only way to build an Android UI

far from the only way! (as you explain).

Re:Building a bare-metal bootable game for Raspberry Pi in C# by mihular on Tuesday December 12, 2023 @01:16PM (#38616075)
Duh, yes, typo, thanks.
Re:Building a bare-metal bootable game for Raspberry Pi in C# by jmaker on Wednesday December 13, 2023 @11:19AM (#38629583)
In my experience Uno and Avalonia UI are quite experimental still. And I totally dislike their looks. I spoke to Mike on the topic of theming, hope they introduce something more modern. To be fair, Avalonia UI is only becoming multiplatform.

Uno has been very unstable, not production ready in my books.

As for Kotlin, it’s just a language running on a JVM or any other supported target. The interop with Java is stellar. You can use Swing or JavaFX, which now goes by OpenFX, for the desktop. Vaadin and Hilla target V8. There’s also Kotlin/js. There’s really a lot. Compose is much like SwiftUI, composable, similar to React in a way.

Re:Building a bare-metal bootable game for Raspberry Pi in C# by pjmlp on Monday December 11, 2023 @01:06PM (#38603106)
Kotlin is really only relevant for Android, and because Google says so.

And even in spite of that, they had to backtrack on leaving Java behind, as Android was slowly not able to consume modern Java libraries.

Kotlin on the browser lags behind Blazor, and Kotlin/Native was so badly implemented they had to redo the whole memory management concept, originally incompatible with JVM semantics.

Re:Building a bare-metal bootable game for Raspberry Pi in C# by jmaker on Wednesday December 13, 2023 @11:42AM (#38629937)
Kotlin is used in many places where Java is or could be used. Some teams prefer Kotlin over Java for new Spring or Quarkus or Vert.x or Micronaut projects. Kotlin is relevant everywhere outside Google’s realm, too.

I’m unaware of that backtracking you’re mentioning, could you give some context?

How do you measure it lagging behind in the browser? According to Krause’s benchmarks Blazor’s WASM performance is steadily in the bottom 5% of tested frameworks, and devs generally tend to express that Blazor is suitable only for internal enterprise apps where the end users are lenient enough to accept such performance.

The limited GC in the initial Native implementation was reworked long time ago.[1]

[1]: https://kotlinlang.org/docs/whatsnew17.html#kotlin-native

Re:Building a bare-metal bootable game for Raspberry Pi in C# by gregmac on Monday December 11, 2023 @11:06AM (#38601780)
> WASM, Android, and iOS targeting is subpar

How so?

Re:Building a bare-metal bootable game for Raspberry Pi in C# by tuwtuwtuwtuw on Monday December 11, 2023 @12:54PM (#38602924)
> showmanship

What do you mean by that? I know what the term means but considering it's one of the most used programming stacks I don't understand what you mean when you use it.

Re:Building a bare-metal bootable game for Raspberry Pi in C# by babypuncher on Monday December 11, 2023 @06:13PM (#38606786)
I don't know what they're talking about. I've always viewed .NET, C# in particular, as not being very flashy and more targeted towards "getting stuff done". It does not shine particularly bright in any one specific area, but it is competent enough in most use cases to be a very safe choice for a wide array of applications.
Re:Building a bare-metal bootable game for Raspberry Pi in C# by drzaiusx11 on Monday December 11, 2023 @08:35PM (#38608123)
Only thing flash-y related to C# was Silverlight but that's long since dead.
Re:Building a bare-metal bootable game for Raspberry Pi in C# by subtra3t on Tuesday December 12, 2023 @12:31PM (#38615400)
I would think C# is meant to be a general purpose language based on that. Python too is a general purpose language but community libraries (which I think the support for C extensions helped with) enabled amazing things like scipy.

Similarly I think C# excels at game development because of the many engines it is used. Maybe it began because of XNA but then got popularised because of Unity but I do not think it is due to any special features in C# itself that are not found in other languages. I am not sure about this so please correct me if I am wrong.

Re:Building a bare-metal bootable game for Raspberry Pi in C# by neonsunset on Tuesday December 12, 2023 @01:59PM (#38616692)
Hmm, out of all languages with GC, C# offers lowest level constructs (pointers, tracked references (refs), pure C structs and low/zero-overhead interop)*, which something all other options either don't offer at all, or offer partially or with higher overhead and worse UX. All of these are very useful for interoperating with graphics APIs directly and managing memory manually for performance sensitive code paths.

I don't think these were the reason behind C#'s rise in gamedev historically, but they do ensure it continues to be its mainstay.

*today you can also add powerful SIMD and BLAS-adjacent abstractions to this list, a good showcase of which would be Bepuphysics2 which is a heavily vectorized physics engine written in pure C# that is as fast as PhysX and faster than Jolt (another SIMD-using physics library written in C++)

https://github.com/bepu/bepuphysics2

Re:Building a bare-metal bootable game for Raspberry Pi in C# by Zambyte on Monday December 11, 2023 @09:12AM (#38600773)
> developer tools (Visual Studio) that works across Windows, macOS, and Linux

Dang I was really excited when I saw this because I thought I missed something, but still only support for Windows :(

Re:Building a bare-metal bootable game for Raspberry Pi in C# by znite on Monday December 11, 2023 @09:47AM (#38601085)
There's also Jetbrains Rider for .net on mac & Linux (google it)
Re:Building a bare-metal bootable game for Raspberry Pi in C# by Zambyte on Monday December 11, 2023 @12:05PM (#38602318)
I'm familiar. I was looking for Visual Studio, which is not Rider.
Re:Building a bare-metal bootable game for Raspberry Pi in C# by pjerem on Monday December 11, 2023 @11:58AM (#38602267)
& Windows

Because it's better than VS anyway ;)

Re:Building a bare-metal bootable game for Raspberry Pi in C# by andyjohnson0 on Monday December 11, 2023 @09:25AM (#38600883)
Visual Studio for Mac is a thing and I find it pretty good. It doesn't feel as feature complete as the Windows version, but I've never found anything I couldn't work around.

Unfortunately it's being retired at the end of August next year. Thanks a bunch Microsoft.

Re:Building a bare-metal bootable game for Raspberry Pi in C# by hu3 on Monday December 11, 2023 @09:37AM (#38600999)
https://www.jetbrains.com/rider/

is amazing and cross-platform. From the same authors of ReSharper plugin for Visual Studio.

Re:Building a bare-metal bootable game for Raspberry Pi in C# by all2 on Monday December 11, 2023 @11:36AM (#38602064)
I'll second Rider. Well worth the money, in my experience. I use Rider products exclusively on Linux, and they tend to work well.
Re:Building a bare-metal bootable game for Raspberry Pi in C# by cptskippy on Monday December 11, 2023 @10:21AM (#38601392)
Rider and VS Code are slowly killing Visual Studio for .NET development. Unless you're using .NET Framework (legacy framework with confusing name), you're likely better served using anything else.
Re:Building a bare-metal bootable game for Raspberry Pi in C# by calamari4065 on Monday December 11, 2023 @11:34AM (#38602055)
For a long time, the only reason I ever needed to open VS was for WinForms and WPF visual editing. Earlier this year, Rider implemented a WYSIWYG editor for those frameworks. I think based on Avalonia.

Now I have no reason to use VS at all, and my life is better for it

Re:Building a bare-metal bootable game for Raspberry Pi in C# by andyjohnson0 on Monday December 11, 2023 @12:50PM (#38602861)
> Rider and VS Code are slowly killing Visual Studio for .NET development.

You're probably right, but I never understand the dislike for VS on HN. For me it's s a reliable, capable tool.

Re:Building a bare-metal bootable game for Raspberry Pi in C# by cptskippy on Monday December 11, 2023 @01:46PM (#38603700)
My only complaint with VS is that it's optimal resource requirements always seem to be just beyond the limits of my work issued machine. Functionally I have no issues with it and it's worlds better than a lot of other IDEs that I've used.
Re:Building a bare-metal bootable game for Raspberry Pi in C# by subtra3t on Tuesday December 12, 2023 @12:41PM (#38615556)
Could you share the specs of your mschine? Visual Studio seems to run decently on my 4 GB laptop with an 8th generation i3 CPU. It does have an SSD though.

It does not run perfectly though. There is definitely a difference in input lag between VS and Sublime text.

Re:Building a bare-metal bootable game for Raspberry Pi in C# by cptskippy on Tuesday December 12, 2023 @02:21PM (#38616980)
I have an i9-9880H with 16GB of RAM, I'm in the queue for an upgrade.

VS 2022 Enterprise takes a solid 78 seconds to load to the "Open recent" splash page and idles there at 5%. Opening a 16 project solution takes another 34 seconds and the CPU hovers around 48-67% CPU for a minute after opening the solution before dropping down to around 6%. Any coding causes CPU spikes with each keystroke up to 67%. Loading a 150 line class is pretty instantaneous but it takes another 15-20 seconds for the references, last changes, collapsible UI, and inherit/override dialogs to appear.

It always feels like I'm waiting, even if it's just 5 or 10 seconds, for what I need.

Re:Building a bare-metal bootable game for Raspberry Pi in C# by subtra3t on Wednesday December 13, 2023 @08:39AM (#38627155)
Huh. That seems odd to me but I only open 1 project solutions with not more than ~5 files open at a time, with no other applications other than my browser running. But those CPU spikes upon each keystroke seems very odd indeed.
Re:Building a bare-metal bootable game for Raspberry Pi in C# by jmaker on Wednesday December 13, 2023 @07:39PM (#38636309)
Yes, VS has been terribly slow all the years. Having 64g RAM doesn’t always help much. Rider is fine on 16g, though the most recent release turned a bit sluggish after updating the SDK from RC2 to final, likely something misconfigured on my machine.
Re:Building a bare-metal bootable game for Raspberry Pi in C# by subtra3t on Tuesday December 12, 2023 @12:34PM (#38615432)
I think it is because of the usual HN-esque disdain for corporate products and their urge to exercise their freedom to choose other products.
Re:Building a bare-metal bootable game for Raspberry Pi in C# by pjmlp on Monday December 11, 2023 @01:09PM (#38603145)
Except VS is the first party IDE, and Microsoft already acknowledged VS Code will never provide feature parity with VS.

Rider, being a 3rd party IDE, will always be playing catchup with VS and .NET tooling from Microsoft.

Re:Building a bare-metal bootable game for Raspberry Pi in C# by cptskippy on Monday December 11, 2023 @01:40PM (#38603607)
> Microsoft already acknowledged VS Code will never provide feature parity with VS.

That's correct and misleading. The features that VS supports that aren't present in VS Code are mostly legacy features that need to exist for legacy support reasons and are not being utilized in modern development.

Re:Building a bare-metal bootable game for Raspberry Pi in C# by pjmlp on Monday December 11, 2023 @02:14PM (#38604115)
Like native desktop Windows applications, and server profiling tooling?

This has been asserted by Microsoft employees in .NET podcasts, and on twitter, maybe start paying attention?

Re:Building a bare-metal bootable game for Raspberry Pi in C# by jmaker on Wednesday December 13, 2023 @07:34PM (#38636275)
Microsoft just introduced some features taken from Rider in Visual Studio, who’s catching up with whom? I think it’s a good way of competition.
Re:Building a bare-metal bootable game for Raspberry Pi in C# by babypuncher on Monday December 11, 2023 @06:16PM (#38606819)
Others have mentioned Rider, which is excellent.

If you're looking for a free alternative, VS Code with the most recent .NET/C# extensions is a very good experience. Good enough that I suspect it is the reason MS felt it no longer worth maintaining Visual Studio for Mac.

Re:Building a bare-metal bootable game for Raspberry Pi in C# by Mountain_Skies on Monday December 11, 2023 @11:26AM (#38601965)
They might have meant Visual Studio Code, which due to Microsoft's continued commitment to naming things poorly, causes a good deal of confusion. VS Code doesn't have all the features of Visual Studio but it's turning into its own impressive ecosystem that even diehard Microsoft haters love.
Re:Building a bare-metal bootable game for Raspberry Pi in C# by donny2018 on Monday December 11, 2023 @11:39AM (#38602086)
You almost can’t even escape it at this point. VS Code ecosystem is a beast.
Re:Building a bare-metal bootable game for Raspberry Pi in C# by pjmlp on Monday December 11, 2023 @01:11PM (#38603172)
The only reason why I tolerate that Electron app, is exactly some tooling only supporting it, e.g. VS Code is now the official IDE for Powershell.
Re:Building a bare-metal bootable game for Raspberry Pi in C# by qingcharles on Monday December 11, 2023 @07:07PM (#38607290)
I find ASP.Net Core to be a fantastic dev platform. I'm running it on a $3/mo Hetzner ARM server. ASP ships with its own highly optimized web server out of the box and Microsoft also has their own Nginx competitor now too. Plus, in some scenarios you can compile down to native and run a very slim system.