WMI - Expand PlatformNotSupported_FrameworkUpdatedRequired error coverage
#39.488 aperta il 16 lug 2020
Metriche repository
- Star
- (17.886 star)
- Metriche merge PR
- (Merge medio 12g 11h) (661 PR mergiate in 30 g)
Descrizione
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.