Skip to content
Discussion options

You must be logged in to vote

I verified that Assembly.Location is not available for a Native AOT compiled shared library.

It is intentional because assemblies does not map to files after NativeAOT compiling. A native executable or shared library always consists of multiple assemblies. Assembly.Location always returns null under NativeAOT.

so the question is: are the methods to retrieve the native library location considered unreliable

The attached code is incorrect. Although it's a convention that the generated native object matches the name of your entry assembly, it can't match other assemblies used. For example it can never deal with typeof(object).Assembly.

Replies: 2 comments 7 replies

Comment options

You must be logged in to vote
7 replies
@huoyaoyuan
Comment options

@ceztko
Comment options

@huoyaoyuan
Comment options

@ceztko
Comment options

@ceztko
Comment options

Answer selected by ceztko
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants