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 8586417
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:18:21+00:00 2026-06-11T22:18:21+00:00

Looking through System.Linq.Enumerable in DotPeek I notice that some methods are flavoured with a

  • 0

Looking through System.Linq.Enumerable in DotPeek I notice that some methods are flavoured with a [__DynamicallyInvokable] attribute.

What role does this attribute play? Is it something added by DotPeek or does it play another role, perhaps informing the compiler on how best to optimise the methods?

  • 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. Editorial Team
    Editorial Team
    2026-06-11T22:18:22+00:00Added an answer on June 11, 2026 at 10:18 pm

    It is undocumented, but it looks like one of the optimizations in .NET 4.5. It appears to be used to prime the reflection type info cache, making subsequent reflection code on common framework types run faster. There’s a comment about it in the Reference Source for System.Reflection.Assembly.cs, RuntimeAssembly.Flags property:

     // Each blessed API will be annotated with a "__DynamicallyInvokableAttribute".
     // This "__DynamicallyInvokableAttribute" is a type defined in its own assembly.
     // So the ctor is always a MethodDef and the type a TypeDef.
     // We cache this ctor MethodDef token for faster custom attribute lookup.
     // If this attribute type doesn't exist in the assembly, it means the assembly
     // doesn't contain any blessed APIs.
     Type invocableAttribute = GetType("__DynamicallyInvokableAttribute", false);
     if (invocableAttribute != null)
     {
         Contract.Assert(((MetadataToken)invocableAttribute.MetadataToken).IsTypeDef);
    
         ConstructorInfo ctor = invocableAttribute.GetConstructor(Type.EmptyTypes);
         Contract.Assert(ctor != null);
    
         int token = ctor.MetadataToken;
         Contract.Assert(((MetadataToken)token).IsMethodDef);
    
         flags |= (ASSEMBLY_FLAGS)token & ASSEMBLY_FLAGS.ASSEMBLY_FLAGS_TOKEN_MASK;
     }
    

    Without further hints what a “blessed API” might mean. Although it is clear from the context that this will only work on types in the framework itself. There ought to be additional code somewhere that checks the attribute applied to types and methods. No idea where that is located, but given that it would have to need to have a view of all .NET types to have a shot at caching, I can only think of Ngen.exe.

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

Sidebar

Related Questions

In looking at System.Linq.Enumerable through Reflector i noticed that default iterator used for Select
Looking through some java code and this just does not seem right. To me,
In reviewing some system software concepts, I'm looking through my old OS project done
I'm looking through a legacy system and have found that the Dundas charts throws
I've been looking through the search system and not come across an answer for
I am working on a php/mysql login system for a webproject. After looking through
Looking through decimal.py , it uses NotImplemented in many special methods. e.g. class A(object):
Looking through a few SQL implementations, I noticed that most DBMSs support defining an
Looking through the documentation for CFDataRef I can't see anything that will compress a
While looking through some old code I came across this gem: MyObject o =

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.