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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T20:49:24+00:00 2026-06-10T20:49:24+00:00

When someone uses the Task Manager to end a .NET process which has instantiated

  • 0

When someone uses the Task Manager to end a .NET process which has instantiated a COM object, AFAIK there is no way to call Marshal.FinalReleaseComObject in a try {} finally {}, using {} or event handling block.

The next time I fire up the application, the COM object is in an unusable state and I need to reboot the machine to make it work again.

I use Marshal.BindToMoniker to instantiate the object.

What am I doing wrong, is there anything I missed?


I tried Saeed’s suggestion but it didn’t work

private const int WM_CLOSE = 0x0010;

protected override void WndProc(ref Message m)
{
    if (m.Msg == WM_CLOSE)
    {
        logger.Info("WM_CLOSE");
        Marshal.FinalReleaseComObject(comObject);
    }

    base.WndProc(ref m);
}
  • 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-10T20:49:26+00:00Added an answer on June 10, 2026 at 8:49 pm

    Task Manager is using the native equivalent of Process.Kill (or possibly something even stronger). Note this narrative from the documentation:

    Kill forces a termination of the process, while CloseMainWindow only requests a termination.

    …

    Calling CloseMainWindow sends a request to close to the main window, which, in a well-formed application…

    And,

    Data edited by the process or resources allocated to the process can be lost if you call Kill. Kill causes an abnormal process termination and should be used only when necessary.

    In short, there’s nothing you can really do from inside your program code to protect against this – the plug has been pulled. No window messages are going to be sent.

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

Sidebar

Related Questions

I was provided with an ant build file from someone else which uses svnant
When someone uses the OutputCache directive in an ASP.NET WebForms/MVC application, does it actually
The last release os ODP.NET already supports Entity Framework? Someone uses it? If the
We have a project which uses the standalone Hibernate Tools Ant task to build
Here is the scenario: I have a java main process, which uses JMS to
I've got the task of making a car rental program, which uses linked lists
I have the task related to Radon transform which contains a subtask which uses
If someone uses enum name as follows: class Logger { public: enum LEVEL {
Could you someone shed some light on the hashing function/algorithm Perl uses to map
Could someone translate this, into a syntax that uses the built in variables? \\myserver\builds\mybuild\Daily_20090525.1\Release\_PublishedWebsites\myWebsite

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.