We are upgrading to .Net 6. This code worked fine in .Net 5:
public static string GetSystemUUID()
{
string uuid = "";
ManagementObjectSearcher Searcher = new ManagementObjectSearcher("SELECT UUID FROM Win32_ComputerSystemProduct");
foreach (ManagementObject WmiObject in Searcher.Get())
{
uuid = WmiObject["UUID"].ToString();
}
return uuid;
}
I have upgraded to System.Management to 6.0.0 and upgraded all microsoft extension pacakges and aspnet core packages to .Net 6. I still get the following Exception:
"The type initializer for 'System.Management.ManagementPath' threw an exception."
With this inner exception:
"Built-in COM has been disabled via a feature switch. See https://aka.ms/dotnet-illink/com for more information."