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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T05:10:30+00:00 2026-05-18T05:10:30+00:00

I attach a debugger by passing ‘-d’ as a command line parameter to my

  • 0

I attach a debugger by passing ‘-d’ as a command line parameter to my console app. That causes the following code to be called;

bool attachedDebugger = false;
try
{
   attachedDebugger = System.Diagnostics.Debugger.Launch();
}
catch (Exception) { }
finally
{
   Console.WriteLine(attachedDebugger ? "Debugger Attached" : "Failed to attach debugger");
}

After the Visual Studio 2010 JIT window pops up I sometimes change my mind and don’t want to debug, so I dismiss the dialog. If I don’t attach one then the Application exits immediately without anything being written to the console.

I know that this it a bit of an edge use case, I should just remove the ‘-d’ from the command line if I don’t want to debug. The reason for my question is that I wish to understand what’s happening.

I thought the finally block is always called, furthermore I would expect my application to continue if we fail to attach a debugger.

  • Why is nothing printed to the console
    if I decline attaching a debugger?
  • Does Debugger.Launch() call
    System.Exit on failure to attach?

EDIT Thanks @Moo-Juice I now know that a return value of false implies a debugger was already attached but the questions above remain unresolved.

  • 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-18T05:10:31+00:00Added an answer on May 18, 2026 at 5:10 am

    This is a reported bug in dotnet 4.0

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

Sidebar

Related Questions

Can an attacker attach a debugger to my app after installing it to the
Using Xcode 3.1 on OSX 10.5; is it possible to attach (the debugger) to
How is this tool used? Not the debugger, I mean Tools > Attach to
How would you attach a propertychanged callback to a property that is inherited? Like
I want to attach an xslt stylesheet to an XML document that I build
How do i attach debugger to Sql 2008 Express edition from Management Studio?
I need to attach a debugger to a remote instance of WAS and know
Symptoms: I attach a debugger, I wait a little while, it automatically detaches I
Is it possible to attach a debugger to an AIR process like it is
Normally to attach a debuger to a running jvm you would need start 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.