Skip to content

Why does the COM registration generated by the AOT fail, and how do I generate it correctly? #110264

Answered by reflectronic
vitash asked this question in Q&A
Discussion options

You must be logged in to vote

EnableComHosting does not work with Native AOT. The Xxx.comhost.dll it generates is only designed to work with CoreCLR. I think the SDK should emit an error when EnableComHosting is combined with PublishAot.

It is still possible to write a COM server with Native AOT, but you will have to write the server code manually by implementing IClassFactory, exporting DllRegisterServer, etc. like described in COM Server Responsibilities. You will also have to switch your interop to ComWrappers source generation and away from ComImport (which does not work with Native AOT).

@AaronRobinsonMSFT @jkoritzinsky

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@AaronRobinsonMSFT
Comment options

@jkoritzinsky
Comment options

@agocke
Comment options

@MichalStrehovsky
Comment options

Answer selected by AaronRobinsonMSFT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
6 participants