dotnet/runtime

WMI - Expand PlatformNotSupported_FrameworkUpdatedRequired error coverage

Open

#39 488 ouverte le 16 juil. 2020

Voir sur GitHub
 (9 commentaires) (0 réactions) (0 assignés)C# (5 445 forks)batch import
area-System.Managementenhancementhelp wanted

Métriques du dépôt

Stars
 (17 886 stars)
Métriques de merge PR
 (Merge moyen 12j 11h) (661 PRs mergées en 30 j)

Description

Description

Issue https://github.com/dotnet/runtime/issues/24536 outlined an exception where WMI would fail to work correctly if the machine has an old .NET Framework version installed. https://github.com/dotnet/corefx/pull/26137 improved the situation by adding a better error message. It appears that this "fix" does not cover all cases as a customer reported this exception to me today: The type initializer for 'System.Management.ManagementPath' threw an exception. -> The type initializer for 'System.Management.WmiNetUtilsHelper' threw an exception.

Configuration

Customer specs are:

  • Windows 7 32-bit
  • .NET Framework 4.5
  • .NET Core 3.1.5
  • System.Management package 4.7.0

Other information

The customer was able to resolve the problem by upgrading to .NET Framework 4.8. I would like to request that the PlatformNotSupported_FrameworkUpdatedRequired error coverage be extended to support this scenario so a better error message is presented.

I believe this code is what causes the exception to occur:

var diskSearcher = new ManagementObjectSearcher("SELECT * FROM Win32_DiskDrive");
diskSearcher.Get();

Also, a question: What is the minimum .NET Framework version for WMI to work correctly? So I can check for it and warn the user.

Guide contributeur