BTW, here is some sample code that exhibits the problem:
using System;
using System.Reflection;
using System.Reflection.Emit;
namespace TestApp
{
public class Test
{
public static void DoTest()
{
AppDomain appDomain = AppDomain.CurrentDomain;
AssemblyName assemblyName = new AssemblyName();
assemblyName.Name = "MyDynamicAssembly";
AssemblyBuilder assemblyBuilder =
appDomain.DefineDynamicAssembly(assemblyName,
AssemblyBuilderAccess.RunAndSave);
ModuleBuilder moduleBuilder =
assemblyBuilder.DefineDynamicModule("MyDynamicAssembly");
TypeBuilder typeBuilder =
moduleBuilder.DefineType("MyDynamicClass", TypeAttributes.Public);
ConstructorBuilder constructorBuilder =
typeBuilder.DefineDefaultConstructor(MethodAttributes.Public);
typeBuilder.CreateType();
assemblyBuilder.Save("MyDynamicAssembly.dll");
}
}
}
[quoted text, click to view] "Frank" <google@xemaps.com> wrote in message
news:79383fe.0407272221.40d77aba@posting.google.com...
> I am emitting a dynamic assembly (marked with the RunAndSave flag).
>
> I can successfully instantiate the "dynamic" class in my dynamic
> assembly. I can successfully call a method on that dynamic class.
>
> When I call the assembly builder's Save() method, an assembly dll
> (e.g., MyDynamicAssembly.dll) is created and it's 2K, but contains no
> IL or classes.
>
> ILDASM shows the following:
> -----------------------------
> .assembly MyDynamicAssembly
> {
> .hash algorithm 0x00008004
> .ver 0:0:0:0
> }
> .module RefEmit_OnDiskManifestModule
> // MVID: {299B3249-3C2C-4751-B239-B450A88FFCED}
> .imagebase 0x00400000
> .subsystem 0x00000003
> .file alignment 512
> .corflags 0x00000001
> // Image base: 0x06d10000
> -----------------------------
>
> That's it. No classes or IL. Is it possible to persist an assembly
> with all the IL and type information, so that I don't have to recreate
> it every time the app runs?
>
> Thanks a million,
> Frank