© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
4 replies
Kuba_Z2

Process.EnableRaisingEvents does not work on Windows

I have an app that have 20 workers that are other processes. On production, on ubuntu, when I close the main process with ^C, the workers die as they should, but on Windows, when I kill the process, the workers still exist and use 100% of my i9-12900k (lol), it's because the workers have endless loops and throw exceptions in them when there is no main process. When I close app console window, the main process and workers are not closed and when I kill the main process, I have 100% of cpu usage. Did I miss something?
I use this method to create a worker:
        private Process CreateProcess()
        {
            var process = new Process()
            {
                StartInfo = new("ScriptingService", _arguments),
                EnableRaisingEvents = true,
            };
            process.Start();
            return process;
        }
        private Process CreateProcess()
        {
            var process = new Process()
            {
                StartInfo = new("ScriptingService", _arguments),
                EnableRaisingEvents = true,
            };
            process.Start();
            return process;
        }
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ Setting work area does not work on windows 10, workarounds?
C#CC# / help
3y ago
Console.SetCursorPosition does not work properly on windows terminal.
C#CC# / help
12mo ago
Desktop app on Windows - inter process communication / permissions problem.
C#CC# / help
2y ago
✅ Process API: Memory Leaks in Windows (?)
C#CC# / help
13mo ago