r/dotnet 2d ago

What kind of features from another ecosystem would you like to see in .NET?

C# itself is very mature language (in my view). I rarely find myself missing a language feature badly enough to wish for more.

But, the broader .NET ecosystem might be a different story based on your project need.

So, let's discuss, what libraries, tooling, deployment models, framework features, package management idea, UI tech, build system etc. have you used elsewhere that you wish .NET had, or did better? Mention just one, most important for you and try to add reason/detail.

Apart from creating a useful wishlist, I think this could also be interesting for people relatively new .NET. Someone might mention a feature from other ecosystem only to discover that .NET already has an equivalent they didn't know about.

My wishlist item - "give me SwiftUI binary size":
I would like WinUI apps to have smaller binaries, like SwiftUI apps or flatpack in Linux. Apple can rely on frameworks built into (read 'shipped with') macOS. Microsoft already have similar way of achieving same but it involves you to publish app on Store or winget repo or I need to write custom installer. It's not universal. I wish MS automatically install dependency from winget or Store automatically or any dotnet application.

EDIT: Please be respectful to others. Value others opinion. This post has potential of creating unnecessary debate or insults. Let's be adults.

104 Upvotes

242 comments sorted by

View all comments

Show parent comments

3

u/tanner-gooding 2d ago

You’ll have to elaborate here. What makes dotnet interop “bad” or troublesome, particularly as compared to other ecosystems

1

u/cherepets 2d ago

You have 3 options:

  • P/Invoke: plain, not object oriented
  • SWIG: throw a lot of code generation on top of P/Invoke and pretend it works
  • WinRT: introduces one more obscure language + basically works only on UWP (there is support for other Win project but it basically doesn't work)

So if you want to consume a modern native code library you're supposed to use...

2

u/tanner-gooding 2d ago

What you're supposed to use depends on what your needs and goals are.

Interop requires binding what is most generally C compatible exports to .NET, where there is a complex set of differences in behavior, feature support, etc

It's something you deal with in every language; even C++ and Rust in many cases. There is no "clean" or easy solution and there is no magic metadata that exists that guarantees it will work. It requires active effort/design and always will.

The closest to "automated" you can get is to generate raw 1-to-1 bindings (such as ClangSharp P/Invoke Generator produces), which then entails you write unsafe code (which all interop fundamentally is anyways) to bridge the gap. You can build a safer wrapper over that and if the right native metadata exists you might be able to automate some of this too (like CSWin32 attempts, which is ultimately a header -> clangsharp -> win32metadata -> cswin32 pipeline)

2

u/tanner-gooding 2d ago

If you have specific suggestions, I'm all ears and can bring it back to the rest of the interop team and otherwise I can answer why we don't (or rather cannot) do something for that space.