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

  • SEARCH
  • Home
  • 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 6120403
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:39:52+00:00 2026-05-23T15:39:52+00:00

Consider the following C# code: class Program { static public void Print(string toPrint) {

  • 0

Consider the following C# code:

class Program
{
    static public void Print(string toPrint)
    {
        Console.WriteLine(toPrint);
    }

    static void Main(string[] args)
    {
        Type program = typeof(Program);            
        MethodInfo methodInfo = program.GetMethod("Print", BindingFlags.Static | BindingFlags.Public);
        methodInfo.Invoke(null, new object[] { "a" });
    }
}

When I run it in either Visual Studio 2008 or Visual Studio 2008 and hit a breakpoint I put inside the “Print” method, I get the following in the callstack window:

ConsoleApplication4.exe!ConsoleApplication4.Program.Print(string
toPrint)

[Native to Managed Transition]

[Managed to Native Transition]

ConsoleApplication4.exe!ConsoleApplication4.Program.Main(string[]
args)

Why doesn’t RuntimeMethodInfo.Invoke show up in my callstack? It is a managed method, after all, so why don’t I see it as I would expect?

Also, in general, what are the rules here? Which managed methods can I expect to be missing from my callstack?

  • 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-05-23T15:39:52+00:00Added an answer on May 23, 2026 at 3:39 pm

    The reason is that the method isn’t actually a managed method. RunTimeMethodInfo.Invoke will eventually resolve down to RuntimeMethodHandle._InvokeMethodFast which is marked as an MethodImplOptions.InternalCall. This means the call is actually implemented as a helper directly in the CLR.

    In terms of general rules for what won’t show up in your call stack:

    • If you have Just My Code enabled (which is the default) pretty much anything you didn’t write will show up as [External Code] on the call stack.
    • If you are debugging managed only then you’ll probably end up seeing a lot of Native to Managed and Managed to Native transitions on the call stack.
    • When dealing with internally implemented methods, you’ll also see a bit of fuzziness on the call stack.
    • I’m not sure on the exact rules for DebuggerHidden, especially when combined with ‘just my code’ methods, but I wouldn’t necessary expect them to show up on the call stack.

    If you want to see the raw call stack in all of its glory then you’ll need to do the following.

    • Debug with both managed and native debugging enabled
    • Disable Just My Code
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider the following code: class Program { static void Main(string[] args) { Department deathStar
Consider the following code: class Program { static void Main(string[] args) { A a
Consider the following code: class Program { static void Main(string[] args) { new Program().Run(args);
Consider the following code: using System; namespace ConsoleApplication2 { class Program { static void
Consider the following code: namespace DisposeTest { using System; class Program { static void
Consider the following code: private static void WriteProcesses(StreamWriter sw, DateTime d) { sw.WriteLine(List of
Consider the following code: class Program { static Program() { Program.program1.Value = 5; }
Consider the following code: public class Vehicle { public void StartEngine() { // Code
Consider the following code : public class RandomClass { private readonly string randomString; public
Consider the following code: public class Bar { Foo foo; void Go() { foo

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.