C
C#10mo ago
nathanAjacobs

What exactly do these limitations mean for NativeAOT?

Native AOT deployment overview - .NET
Learn what Native AOT deployments are and why you should consider using it as part of the publishing your app with .NET 7 and later.
14 Replies
Angius
Angius10mo ago
C++/CLI is a way to write C++ assemblies targetting .NET, IIRC COM is also something about C++ interop But I believe it's in the context of some native Windows DLLs
nathanAjacobs
nathanAjacobsOP10mo ago
So basically anything using COM directly in C# won't work, but P/Invoke should still be fine right if using LibraryImport?
cap5lut
cap5lut10mo ago
yeah COM is about interfaces that are implemented by native library (eg, WinForms highly depends on this for their components, but its not limited to GUI stuff) and to interop with that P/Invokes with LibraryImport will work fine, as its compile time code generation COM generally should work but u have more to do urself afaik @ref *&Sergio (sorry if that ping bothered ya, let me know if) knows alot NAOT and COM and trimming, no byte is safe in front of him
nathanAjacobs
nathanAjacobsOP10mo ago
Mostly makes more sense now ty. I don't really know how COM works, so this might not make sense. If it's not as plug and play as LibraryImport, could there be a source generator similar to LibraryImport, but for COM instead?
cap5lut
cap5lut10mo ago
tbh i dont know that much about COM either. the stuff i know is that u basically get a pointer to a native instance and would have to reconstruct their vtable on the C# side to get a working type to use that object, if i understood it correctly
Sergio
Sergio10mo ago
Sorry what's the question?
nathanAjacobs
nathanAjacobsOP10mo ago
I'll have to do some reading up on COM, I'm curious what the limitation actually is. The question was, what exactly do the docs mean when it lists Windows: No built-in COM as a limitation for NativeAOT
Sergio
Sergio10mo ago
Basically [ComImport] doesn't work You need to use ComWrappers
nathanAjacobs
nathanAjacobsOP10mo ago
Thanks for clarifying, I'll need to read more up on COM. That definitely helps though.
cap5lut
cap5lut10mo ago
COM wrappers is what i described there ⤴️ right?
Sergio
Sergio10mo ago
No, that's just COM interop in general This is ComWrappers (I recommend using the generators)
nathanAjacobs
nathanAjacobsOP10mo ago
This is making more sense Lol of course there already is a source generator, that's awesome
cap5lut
cap5lut10mo ago
well, the dotnet team (and contributors) put a lot of thought into what they are doing ;p
nathanAjacobs
nathanAjacobsOP10mo ago
Facts
Want results from more Discord servers?
Add your server