Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 ?

like image 436
newprint Avatar asked Jan 08 '23 08:01

newprint


1 Answers

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

like image 85
thehennyy Avatar answered Jan 25 '23 15:01

thehennyy