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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:53:18+00:00 2026-05-25T11:53:18+00:00

I have a pretty large project that just recently started crashing on exit. I

  • 0

I have a pretty large project that just recently started crashing on exit. I am not the greatest C# coder but everything generally works as intended. In this case however, when I close my console application, it crashes but is not caught by the MSVC Debugger.

1) When I build it in Release and run it, it generally always crashes when I exit.

2) When I build it in Debug and run it, it seems to only crash on exit every 1 out of 3-5 times.

I did manage to get the error though when it didn’t exit properly, but unfortunately the Exit Code doesn’t match anything I can find online.

The program '[11108] MCDaemon.vshost.exe: Managed (v4.0.30319)' has exited with code -1073741510 (0xc000013a).

From what I have read on other people’s questions, this is generally caused by Unmanaged Code acting up. Is there any way I can actually find out what the issue is short of a massive amounts of debug lines?

EDIT

From an answer below, this is the code causing the Exit code, but I don’t really see anything issue with it.

public static Boolean Handler(MyWin32.CtrlTypes CtrlType)
{
    // A switch to handle the event type.
    switch (CtrlType)
    {
        case MyWin32.CtrlTypes.CTRL_C_EVENT:
            Program.TerminateProcess();
            break;
        case MyWin32.CtrlTypes.CTRL_CLOSE_EVENT:
            Program.TerminateProcess();
            break;
    }

    return true;
}

public static void TerminateProcess()
{
    // Stop the Poll Timer from Running
    PollTimer.Stop();

    log.LogMessage("Process is being Shutdown.");
    log.LogMessage("Requesting Process to Stop....");
    SendProcessCmd("stop");

    // Wait and make sure it has exited
    Thread.Sleep(5000);

    if (!myProcess.HasExited)
    {
        log.LogMessage("My Process did not stop on its own, forcing Process to quit.");
        myProcess.Kill();
    }

    log.LogMessage("My Process has been Shutdown.");
}
  • 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-25T11:53:18+00:00Added an answer on May 25, 2026 at 11:53 am
    // Wait and make sure it has exited
    Thread.Sleep(5000);
    

    That’s the problem statement. You are pinvoking SetConsoleCtrlHandler() in your code to get your Handler method called. Windows requires the control handler to be responsive and not take too long to return from the callback. The timeout for the CTRL_CLOSE_EVENT is exactly 5 seconds, explaining why it sometimes works. If it takes longer then Windows pulls the plug on the process.

    You’ll need to implement TerminateProcess differently. Killing a process is fairly arbitrary, you ought to be better off just not doing this. Or start another guard process. I can’t make that call though.

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

Sidebar

Related Questions

Background: I have a project that is not at all large scale (2 ASP.NET
I have a pretty large project in front of me that I intend to
I have an application that is pretty memory hungry. It holds a large amount
I have built a PHP calendar system and have pretty much everything done but
The title pretty much says it all. I have a project that for political
I have a very large project that uses Oracle ODP.NET. Right now it is
At work we have a pretty large web application that works by having a
So i have this pretty large project and i have to create database schemas
As of late, we started a pretty large project (C# XNA game). It seemed
I have a pretty large site and every page is built from several included

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.