Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 124833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T05:03:47+00:00 2026-05-11T05:03:47+00:00

For one of my projects, I need to generate at run time some classes,

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T05:03:47+00:00Added an answer on May 11, 2026 at 5:03 am

    InternalsVisibleTo works by opening an assembly to others. So if you want to use assembly Foo from your generated types, you must specify the name of the generated assembly in AssemblyInfo.cs for Foo.

    If you’re emitting a new assembly using the AssemblyBuilder class, you can specify the name for the generated assembly. This name has to match the name used for the InternalsVisibleTo attribute in assembly Foo.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In one of my projects I need to build an ASP.NET page and some
I am putting some email functionality into one of my asp.net projects: I need
I started using subversion for one of my projects and it would be absolutely
I need to use one of my VB.NET projects in a C++ project. The
I'm working on a solution that has two projects: One ASP.NET web application, and
I've got a junk directory where I toss downloads, one-off projects, email drafts, and
One of my projects use the MyISAM engine in MySQL, but I'm considering changing
In one of the projects I've worked on, the subject of isomorphism versus monomorphism
I have several web application projects in one solution. When I start debugging one
I have 2 projects each one with its own unit test project, and one

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.