newprint
newprint

Reputation: 7136

NotSupportedException is thrown when trying to save Emitted assembly

http://pastebin.com/n6G1jTHQ
My code creates a new assembly and module, and then emits a class SWT(within a new assembly) that should be exactly the same as SWTTFieldsclass. Line 137, saves the assembly/module into a .dll, myAsmBuilder.Save("ModuleOne.dll"); throws the exception:

An unhandled exception of type 'System.NotSupportedException' occurred in mscorlib.dll Additional information: Type 'SWT' was not completed.

Why I am getting this error ? What is missing in my emitted class ?

Upvotes: 4

Views: 851

Answers (1)

thehennyy
thehennyy

Reputation: 4218

You have to call the TypeBuilder.CreateType Method for each TypeBuilder before saving the File.

Upvotes: 9

Related Questions