A dynamic assembly is a .NET assembly that is created dynamically at runtime and hosts generated classes and methods. Usually created via reflection emit
Questions tagged [dynamic-assemblies]
51 questions
29
votes
5 answers
Loading plug-in DLL files, "The invoked member is not supported in a dynamic assembly."
We have custom DLL's that are not included in our initial setup file. They are loaded at runtime. This process worked fine while using .NET 2.0, but we are getting the "The invoked member is not supported in a dynamic assembly" error message now…

Trevorm
- 505
- 1
- 5
- 9
20
votes
2 answers
.net dynamic assemblies
I was recently asked if I knew anything about Dynamic Assemblies in .Net. The short answer was - I don't.
I have found plenty of articles that describe how to create a dynamic assembly but none that truely explain the following:
What they are…

Peanut
- 18,967
- 20
- 72
- 78
19
votes
4 answers
.NET: Accessing non-public members from a dynamic assembly
I'm working on a library that allows users to input arbitrary expressions. My library then compiles those expressions as part of a larger expression into a delegate. Now, for still unknown reasons compiling the expression with Compile…

JulianR
- 16,213
- 5
- 55
- 85
16
votes
1 answer
Using Roslyn Emit method with a ModuleBuilder instead of a MemoryStream
I was having trouble with performance when using Roslyn to compile to a dynamic assembly. Compilation was taking ~3 seconds, compared to ~300 milliseconds to compile the same code when using the CodeDom compiler. Here's a pared-down version of the…

Jordan Kohl
- 310
- 2
- 8
14
votes
1 answer
Why doesn't dynamic keyword work with dynamically loaded assemblies?
I'm working on a CSharp expression evaluator which can be used as you can see below. This component generates code and compiles it in memory and after that, it loads the generated assembly, creates an instance of the generated class and run it.…

lontivero
- 141
- 4
14
votes
3 answers
How to save a dynamically generated assembly that is stored in-memory?
I want to get my hands on an assembly by saving it to disc or reflect it at runtime. The assembly is generated dynamically in memory by third party.
Does anyone know how to do this?

Daniel
- 8,133
- 5
- 36
- 51
10
votes
1 answer
Dynamic Assembly Loading in .Net 4.0
My problem begins with moving a .Net 2.0 application to .Net 4.0. The reason I had to do this was that Windows 8 does not enable the earlier .Net versions by default and my application cannot ask the user to enable it.
The application is a NPAPI…

Isuru
- 594
- 1
- 5
- 19
9
votes
1 answer
Dynamic Assemblies and Methods
I've programmed .NET and C# for years now, but have only recently encountered the DynamicMethod type along with the concept of a Dynamic Assembly within the context of reflection. They seem to always be used within IL (runtime code)…

Noldorin
- 144,213
- 56
- 264
- 302
7
votes
1 answer
Create Dynamic Copy of Existing Assembly/Module
Is it possible to create a dynamic copy of an assembly or module/class? I was able to easily find how to create a dynamic assembly or module from scratch using AssemblyBuilder/ModuleBuilder (as seen here), but is there a way to create a copy of an…

Thick_propheT
- 1,003
- 2
- 10
- 29
6
votes
1 answer
Statically link and compile Runtime w/ compiletoMethod() expression tree
I am working on a project where we're porting the Racket Language to .NET using DLR.
We build up an expression tree and invoke the CompileToMethod() Method:
Relevant executable emission code: (taken from How to Save an Expression Tree as the Main…

Scotty Bauer
- 1,277
- 9
- 14
6
votes
1 answer
How to Save an Expression Tree as the Main Entry Point to a New Executable Disk File?
I'm trying to export an expression tree to a PE assembly as the main entry point. I've acquired a Lambda Expression through building an expression tree, for example:
using System.Linq;
using System;
// 1. use expression trees to create a block…

John K
- 28,441
- 31
- 139
- 229
4
votes
2 answers
Assembly.GetManifestResourceNames() exception because of dynamic assembly
If I run a unit test (mstest) I get an exception if I call assembly.GetManifestResourceNames():
The invoked member is not supported in a dynamic assembly.
This is the problematic code:
Dim assembly As Assembly =…

habakuk
- 2,712
- 2
- 28
- 47
3
votes
1 answer
What is the value of AssemblyLoadContext.Unload() in .NET Core in comparison with regular garbage collection?
.NET Core 3.0 introduced collectible AssemblyLoadContext, which allows to call Unload() method to unload assemblies loaded inside the context.
As per documentation…

Ivan Shimko
- 179
- 1
- 9
3
votes
2 answers
Dynamic assembly created using Reflection.Emit crashes with exit code -532462766
I have been following this article to generate a dynamic assembly as follows:
var directory = new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.Desktop));
var file = new FileInfo(Path.Combine(directory.FullName,…

Raheel Khan
- 14,205
- 13
- 80
- 168
3
votes
1 answer
When can a dynamic module have a type load exception?
I have a dynamic module which gets types added to it as my application runs. The module is created via the following code:
var assemblyName = new AssemblyName("MyAssembly");
var assemblyBuilder =…

ChaseMedallion
- 20,860
- 17
- 88
- 152