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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T08:22:09+00:00 2026-06-06T08:22:09+00:00

Using the VS2010 debugger for managed code is it possible to trigger the finalizer

  • 0

Using the VS2010 debugger for managed code is it possible to trigger the finalizer thread to run?

Use Case:

Using Tasks may throw exceptions on the finalizer of the Task object if the task it
self has thrown exceptions and those has not been taken care of.

Verifying a bugfix whos cause was an unhandled can be time consuming since you’ll need to wait for the finalizer thread to kick in before beeing sure the fix works properly.

I usually do not code using finalizers myself since it causes lots of headache and I have also mailed Microsoft about this. But while it is like this: How can I trigger the finalizer code to run from the debugger as opposed from code.

  • 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-06T08:22:12+00:00Added an answer on June 6, 2026 at 8:22 am

    AFAIK there is no special way to do this from the debugger.

    You can trigger it in your code:

        int i = 0, j = 1;
        new Task(() => Console.WriteLine(j/i)).Start();
        Thread.Sleep(1000); // make sure it has had plenty of time
        //GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced);
        //GC.WaitForPendingFinalizers();
        Console.WriteLine("Did I explode yet?");
        Console.ReadKey();
    

    Now uncomment the two lines to see the exception appear.

    Note this should only be used for scenarios like tests; you should’t really use GC in your regular code.

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

Sidebar

Related Questions

I'm using VS2010. The projects that I'm working on use different source control providers,
I'm using VS2010 Ultimate. Having code: //file IntSet.h #include stdafx.h #pragma once /*Class representing
I'm using VS2010 in C# there is a place in my code where an
A very weird situation... Using the debugger in VS2010 I can look up a
I am working on a collection debugger visualizer in VS2010 using C# and I
From VS2010 in Windows 7 using Directory.Delete(path) from the VS debugger. I have full
I'm using VS2010 Beta 2 to debug some multi-threaded code. Love parallel stacks, etc.
Using VS2010, .NET4.0, MVC3, EF4.1 Code-First I have this POCO entities: public class XBLContent
...using vs2010 and automating office 2007 The merge works fine but the saved document(pathToDestinationFile)
I am using VS2010, working on a WinForms application that uses the ReportViewer control

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.