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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:51:25+00:00 2026-06-18T06:51:25+00:00

This is a sample code from a C# 5.0 in a Nutshell TaskCreationOptions atp

  • 0

This is a sample code from a “C# 5.0 in a Nutshell”

TaskCreationOptions atp = TaskCreationOptions.AttachedToParent;
Task.Factory.StartNew (() =>
{
    Task.Factory.StartNew (() => { throw null; }, atp);
    Task.Factory.StartNew (() => { throw null; }, atp);
    Task.Factory.StartNew (() => { throw null; }, atp);
})
.ContinueWith (p => Console.WriteLine (p.Exception),
                TaskContinuationOptions.OnlyOnFaulted);

I have a “CLR exceptions”: “break on user-unhandled” option checked in my VS2012 settings and running this code provides a VS’s “NRE exception was unhandled by user code” popup on the throw null;

I’ve tried to try-catch exception on Wait in the ContinueWith and later but still got the unhandled exception.

I feel like a solution with turning “CLR exceptions”: “break on user-unhandled” off seems wrong, because I actually handle this exception. So what is the right way to manage it?

  • 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-18T06:51:27+00:00Added an answer on June 18, 2026 at 6:51 am

    The reason for the debugger stopping execution is that “Break on user-unhandled exceptions” will break on any exception that is not handled by a handler in user code (“My Code”).

    Since the TPL, which is the one catching the exception, is not considered user code, the debugger will consider the exception unhandled by user code.

    The problem is, the TPL does not have any other way to trigger TaskContinuationOptions.OnlyOnFaulted, so I’m afraid you’re probably stuck seeing the exceptions.

    Hopefully, getting exceptions isn’t part of your normal flow. If it’s not, seeing the exceptions as unhandled in the debugger may actually be a good thing for debugging errors in your task flow.

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

Sidebar

Related Questions

I am learning to use xmlhttprequest/AJAX. In this sample code from w3schools, I do
I have this sample code for async operations (copied from the interwebs) public class
I have downloaded the sample code from this site for FTP Client http://www.lysesoft.com/products/andftp/index.html But
When I have download sample code from this link and than try to build
I've been using the sample code from this d3 project to learn how to
Another jquery calculation question. I've this, which is sample code from the plugin site
I am new to scheme. This is code sample from SICP course of MIT.
This is a code sample taken from the Google Maps API developer's guide. I'm
I'm trying to use this sample code from Microsoft to determine what encoder options
I'm doing triangle to AABB intersection tests, and I'm taking this sample code from

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.