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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:56:37+00:00 2026-05-27T23:56:37+00:00

I wrote this small application. for some reason i am not being able to

  • 0

I wrote this small application. for some reason i am not being able to print “Hello from a thread” when i run this program. however if i debug it and put a breakpoint inside Do() method, it does print.

Any ideas?

using System;
using System.Threading.Tasks;

namespace ConsoleApplication3
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            Task.Factory.StartNew(Do);
        }

        private static void Do()
        {
            Console.WriteLine("Hello from a thread");
        }
    }
}
  • 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-27T23:56:37+00:00Added an answer on May 27, 2026 at 11:56 pm

    Are you sure that the program simply isn’t closing before you can see the output? Because this works fine for me.

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    
    namespace ConsoleApplication1
    {
        class Program
        {
            private static void Main(string[] args)
            {
                Task.Factory.StartNew(Do);
                Console.Read();
            }
    
            private static void Do()
            {
                Console.WriteLine("Hello from a thread");
            }
        }
    }
    

    Edit: Added the comment I wrote in response to this, including my reasoning to why the text wasn’t printed.

    Its either because the application closes down before the thread has the possibility of outputting the string to the screen. It’s also possible that you simply cant see it because it closes straight away. Either way the reason it worked with the breakpoint is because you keep the application alive longer.

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

Sidebar

Related Questions

I wrote up some small macros to help in setting application-wide font styles, colors
I wrote this function that's supposed to do StringPadRight("Hello", 10, "0") -> "Hello00000" .
I wrote this code I have these errors Cannot implicitly convert type x.Program.TreeNode' to
I wrote this method to check if a page exists or not: protected bool
I wrote this ISAPI filter to rewrite the URL because we had some sites
I wrote a small PHP application that I'd like to distribute. I'm looking for
I'm writing a small application in VB.NET and I would like some of the
I am developing a small application which lists the contents from files of a
I wrote a small program in C# NET a while back to keep a
I have a small ruby application I wrote that's an anagram searcher. It's for

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.