I tried to understand what Microsoft.CSharp.CSharpCodeGenerator does, and figure out where the errors are populated, but the code at the end depends on external files.
The only answer I can give you is if you create an instance with
Assembly.GetExecutingAssembly().CreateInstance("ClassNameExample");
or even with Activator.CreateInstance("Your assembly", "ClassNameExample");
both return null because they rely on a public constructor, check flags
public object CreateInstance(string typeName) { return this.CreateInstance(typeName, false, BindingFlags.Instance | BindingFlags.Public, (Binder) null, (object[]) null, (CultureInfo) null, (object[]) null); } Activator.CreateInstance(assemblyName, typeName, false, BindingFlags.Instance | BindingFlags.Public | BindingFlags.CreateInstance, (Binder) null, (object[]) null, (CultureInfo) null, (object[]) null, (Evidence) null, ref stackMark);
Zinov source share