For one of my projects, I need to generate at run time some classes, and I thought it would be fairly simple to do using Reflection.Emit, but I'm getting MemberAccessExceptions when I run some of the generated code that calls methods that are marked internal in the generator assembly. Is there any way to tell the runtime that the dynamic assembly should be able to access my own code directly? I would really rather not publicly expose any of these members to consumers of my library.
Regarding InternalsVisibleTo, I am unsure how I would go about using it in the case of dynamically generated assemblies. Is this even possible?