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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T19:29:23+00:00 2026-05-17T19:29:23+00:00

Is it possible to suppress first chance supressions in Visual Studio (C# debugger) for

  • 0

Is it possible to suppress first chance supressions in Visual Studio (C# debugger) for specific lines of code?

I want to use first chance exceptions in the debugger, but there are about 50 first chance exceptions I need to go through every debug session before I get to the interesting code.

Currently, I turn off first chance exceptions and then manually turn them on, but that’s a hassle and a time sink.

  • 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-17T19:29:23+00:00Added an answer on May 17, 2026 at 7:29 pm

    DebuggerNonUserCodeAttribute Class

    As of .NET 2.0, if you mark an method with the [DebuggerNonUserCode] attribute, the debugger will skip first chance exceptions in it.

    Quote from MSDN link (emphasis added is mine):

    members
    that are not part of the code
    specifically created by the user can
    complicate the debugging experience
    .
    This attribute suppresses the display
    of these adjunct types and members in
    the debugger window and automatically
    steps through
    , rather than into,
    designer provided code.

    There is no runtime behaviour apart from debugging, associated with this attribute.

    However if you have just one method with certain lines intended for inclusion in Visual Studio’s first chance exception handling mechanism, and other lines to be excluded, there’s likely not a solution at this level of granularity. You can always refactor a large method into multiple methods and use the attribute on select ones.


    Additional Info…

    Example usage from this article

    using System.Diagnostics;
    using XL = Microsoft.Office.Interop.Excel;
    
    public static class WorkbookExtensions
    {
        [DebuggerNonUserCode]
        public static bool TryGetWorksheet(this XL.Workbook wb, string worksheetName, out XL.Worksheet retrievedWorksheet)
        {
            bool exists = false;
            retrievedWorksheet = null;
    
            try
            {
                retrievedWorksheet = GetWorksheet(wb, worksheetName);
                exists = retrievedWorksheet != null;
            }
            catch(COMException)
            {
                exists = false;
            }
    
            return exists;
        }
    
        [DebuggerNonUserCode]
        public static XL.Worksheet GetWorksheet(this XL.Workbook wb, string worksheetName)
        {
            return wb.Worksheets.get_Item(worksheetName) as XL.Worksheet;
        }
    }
    

    The article shows related VS project options that might be useful.
    alt text

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

Sidebar

Related Questions

I want to know wether or not it is possible to suppress a transaction
Is it possible to suppress this specific warning by using @SuppressWarnings(???) ? (I don't
Is it possible to suppress warnings in Eclipse for JDK1.4 project? EDIT: Longer version.
Possible Duplicate: Why not use tables for layout in HTML? Under what conditions should
Possible Duplicate: .NET - What’s the best way to implement a catch all exceptions
Is it possible to suppress the default IE 7 functionality when CTRL +click on
In Python 2.6 it is possible to suppress warnings from the warnings module by
It's possible to suppress warnings on a per-file basis with Google's Closure Compiler via
Is it possible to suppress the unimplemented methods error in eclipse? If so, is
Possible Duplicate: NAnt or MSBuild, which one to choose and when? What is the

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.