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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T16:39:24+00:00 2026-05-19T16:39:24+00:00

Are there any attributes I can apply to boilerplate methods so that such methods

  • 0

Are there any attributes I can apply to boilerplate methods so that such methods do not appear in stack traces? I’ve got a lot of them and in some cases they are several levels deep. It’s just cluttering things.

Example code:

class Program
{
    public static void ThrowMe()
    {
        throw new NotImplementedException();
    }

    public static void HideMe()
    {
        ThrowMe();
    }
    static void Main(string[] args)
    {
        try
        {
            HideMe();
        }
        catch (Exception e)
        {

        }
    }
}

This throws this stack trace:

at Spork.Program.ThrowMe() in C:\Projects\XXX\Testing Sandbox\ConsoleTesting\Program.cs:line 58

at Spork.Program.HideMe() in C:\Projects\XXX\Testing Sandbox\ConsoleTesting\Program.cs:line 64

at Spork.Program.Main(String[] args) in C:\Projects\XXX\Testing Sandbox\ConsoleTesting\Program.cs:line 70

  • 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-19T16:39:24+00:00Added an answer on May 19, 2026 at 4:39 pm

    Put Console.WriteLine(e) in the catch block. Switch to the release build and press Ctrl+F5. You’ll see this:

    System.NotImplementedException: The method or operation is not implemented.
       at ConsoleApplication1.Program.ThrowMe() in C:\Users\hpassant\AppData\Local\Temporary Projects\ConsoleApplication1\Program.cs:line 9
       at ConsoleApplication1.Program.Main(String[] args) in C:\Users\hpassant\AppData\Local\Temporary Projects\ConsoleApplication1\Program.cs:line 17 
    

    Note that the HideMe() method is not visible in the stack trace. Mission accomplished.

    The method call was not shown in the trace because the JIT optimizer inlined the method: this is the only way to hide methods in the stack trace.

    It is not something you can control well, the method has to be ‘small’ and not throw any exception itself. This is otherwise normally considered a problem, not a feature. Hard to figure out how to code got from A to B.

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

Sidebar

Related Questions

Are there any C# attributes that I can apply to class members, to change
Is there any way to get the custom attributes of a specific object I
Is there any syntactical way in jQuery to define multiple CSS attributes without stringing
Is there any way to apply an attribute to a model file in ASP.NET
Is there any free or commercial component written in .NET (no COM interop) that
Is there any query which can return me the number of revisions made to
Is there any way to add custom attributes to properties in EF generated code?
I often find that attributes can be too large. Sometimes it feels like the
Delphi 2010 introduced custom attributes which can be added to type declarations and methods.
while writing a custom attribute in C# i was wondering if there are any

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.