'The program has exited with code -536870873 (0xe0000027)

While running the code the program is automatically exiting from the debug process.

ManagementObjectSearcher wmiData = new ManagementObjectSearcher(@"root\SecurityCenter2", "SELECT * FROM AntiVirusProduct");
        ManagementObjectCollection data = wmiData.Get();

        try
        {
            foreach (ManagementObject virusChecker in data)
            {
                Console.WriteLine(virusChecker["displayName"]);
                Console.WriteLine(virusChecker["instanceGuid"]);
                Console.WriteLine(virusChecker["pathToSignedProductExe"]);
                Console.WriteLine(virusChecker["productState"]);
            }
        }
        catch (Exception e)
        {
            Console.WriteLine("Error: {0}", e);
        }


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source