Skip to content

Why does core_create_delegate appear to only support on-disk assemblies? Can this be changed? #99203

Answered by jkotas
RoryBecker asked this question in Q&A
Discussion options

You must be logged in to vote

create a memory stream of an assembly which I then load into memory using Assembly.Load.

coreclr_create_delegate expects the assembly to be loaded in the default load context. Assembly.Load(byte[]) loads the assembly into its own load context. It explains why coreclr_create_delegate does not see it.

Try loading the in-memory assembly using AssemblyLoadContext.LoadFromStream method instead. It is going to load it explicitly into the default load context and make it visible to coreclr_create_delegate.

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
5 replies
@RoryBecker
Comment options

@jkotas
Comment options

Answer selected by danmoseley
@huoyaoyuan
Comment options

@jkotas
Comment options

@huoyaoyuan
Comment options

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
3 participants