What exactly do these limitations mean for NativeAOT?
- No C++/CLI.
- Windows: No built-in COM
From the docs:
https://learn.microsoft.com/en-us/dotnet/core/deploying/native-aot/?tabs=net8plus%2Cwindows#limitations-of-native-aot-deployment
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
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
So basically anything using COM directly in C# won't work, but P/Invoke should still be fine right if using LibraryImport?
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 himMostly 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?
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
Sorry what's the question?
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
Basically
[ComImport]
doesn't work
You need to use ComWrappersThanks for clarifying, I'll need to read more up on COM. That definitely helps though.
COM wrappers is what i described there ⤴️ right?
This is making more sense
Lol of course there already is a source generator, that's awesome
well, the dotnet team (and contributors) put a lot of thought into what they are doing ;p
Facts