Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix System.Management wminet_utils.dll lookup code for arm64 #83522

Merged
merged 2 commits into from
Mar 16, 2023

Conversation

ViktorHofer
Copy link
Member

@ViktorHofer ViktorHofer commented Mar 16, 2023

Fixes #81400

It's highly unlikely that there will be another side by side .NET Framework installation and as we were already using CompatSwitches.DotNetVersion as the folder probe path, we follow that approach for arm64 as well.

@ghost
Copy link

ghost commented Mar 16, 2023

Tagging subscribers to this area: @dotnet/area-system-management
See info in area-owners.md if you want to be subscribed.

Issue Details

Continuation of #83439
Fixes #81400

@Dharmateja-Challa-Dell are you OK with me working on the fix based on your proposed changes? I cherry-picked your commit into my branch.

Author: ViktorHofer
Assignees: ViktorHofer
Labels:

area-System.Management

Milestone: -

@ViktorHofer ViktorHofer changed the title Syste management arm64 lookup Fix System.Management wminet_utils.dll lookup code for arm64 Mar 16, 2023
@ViktorHofer ViktorHofer marked this pull request as ready for review March 16, 2023 17:16
@ViktorHofer ViktorHofer force-pushed the SysteManagementArm64Lookup branch from 5be2cd8 to 3c2e329 Compare March 16, 2023 17:23
@ViktorHofer ViktorHofer force-pushed the SysteManagementArm64Lookup branch from b5c8ed2 to 2a6b0f4 Compare March 16, 2023 17:27
@carlossanlop
Copy link
Member

carlossanlop commented Mar 16, 2023

I locally ran the System.Management tests in my arm64 laptop. They passed:

C:\repos\runtime\.dotnet\dotnet.exe build -c Release /t:test .\tests\System.Management.Tests.csproj -a arm64 /p:TargetFramework=net8.0-windows
MSBuild version 17.6.0-preview-23108-10+51df47643 for .NET
  Determining projects to restore...
  All projects are up-to-date for restore.
  Microsoft.Interop.SourceGeneration -> C:\repos\runtime\artifacts\bin\Microsoft.Interop.SourceGeneration\Release\netstandard2.0\Microsoft.Interop.Sou
  rceGeneration.dll
  LibraryImportGenerator -> C:\repos\runtime\artifacts\bin\LibraryImportGenerator\Release\netstandard2.0\Microsoft.Interop.LibraryImportGenerator.dll
  TestUtilities -> C:\repos\runtime\artifacts\bin\TestUtilities\Release\net6.0\TestUtilities.dll
  System.CodeDom -> C:\repos\runtime\artifacts\bin\System.CodeDom\ref\Release\net8.0\System.CodeDom.dll
  System.CodeDom -> C:\repos\runtime\artifacts\bin\System.CodeDom\Release\net8.0\System.CodeDom.dll
  System.Management -> C:\repos\runtime\artifacts\bin\System.Management\ref\Release\net8.0\System.Management.dll
  System.Management -> C:\repos\runtime\artifacts\bin\System.Management\Release\net8.0-windows\System.Management.dll
  System.Management.Tests -> C:\repos\runtime\artifacts\bin\System.Management.Tests\Release\net8.0-windows\win-arm64\System.Management.Tests.dll
  ----- start 2023-03-16 14:11:53.01 ===============  To repro directly: ===================================================== 
  pushd C:\repos\runtime\artifacts\bin\System.Management.Tests\Release\net8.0-windows\win-arm64\
  "C:\repos\runtime\artifacts\bin\testhost\net8.0-windows-Release-arm64\dotnet.exe" exec --runtimeconfig System.Management.Tests.runtimeconfig.json --
  depsfile System.Management.Tests.deps.json xunit.console.dll System.Management.Tests.dll -xml testResults.xml -nologo -notrait category=OuterLoop -n
  otrait category=failing 
  popd
  ===========================================================================================================
    Discovering: System.Management.Tests (method display = ClassAndMethod, method display options = None)
    Discovered:  System.Management.Tests (found 18 of 28 test cases)
    Starting:    System.Management.Tests (parallel test collections = on, max threads = 8)
      System.Management.Tests.ManagementClassTests.Create_Delete_Namespace [SKIP]
        Condition(s) not met: "IsElevatedAndSupportsWmi"
      System.Management.Tests.ManagementClassTestsMofRequired.Create_Modify_Delete_Static_Class [SKIP]
        Condition(s) not met: "IsElevatedAndSupportsWmi"
      System.Management.Tests.ManagementClassTestsMofRequired.Create_Modify_Delete_Static_And_Instance [SKIP]
        Condition(s) not met: "IsElevatedAndSupportsWmi"
      System.Management.Tests.ManagementObjectTests.PlatformNotSupportedException_On_Nano [SKIP]
        Condition(s) not met: "IsWindowsNanoServer"
    Finished:    System.Management.Tests
  === TEST EXECUTION SUMMARY ===
     System.Management.Tests  Total: 26, Errors: 0, Failed: 0, Skipped: 4, Time: 0.602s
  ----- end 2023-03-16 14:11:54.39 ----- exit code 0 ----------------------------------------------------------

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:04.91

The full output xml shows the list of tests that ran:

<?xml version="1.0" encoding="utf-8"?>

<assemblies timestamp="03/16/2023 14:01:02">

  <assembly name="C:\repos\runtime\artifacts\bin\System.Management.Tests\Debug\net48\System.Management.Tests.DLL" environment="64-bit .NET 4.0.30319.42000 [collection-per-class, parallel (8 threads)]" test-framework="xUnit.net 2.4.2.0" run-date="2023-03-16" run-time="14:01:00" config-file="C:\repos\runtime\artifacts\bin\System.Management.Tests\Debug\net48\System.Management.Tests.dll.config" total="26" passed="21" failed="1" skipped="4" time="2.586" errors="0">

    <errors />

    <collection total="12" passed="11" failed="0" skipped="1" name="Test collection for System.Management.Tests.ManagementClassTests" time="1.942">

      <test name="System.Management.Tests.ManagementClassTests.Create_Delete_Namespace" type="System.Management.Tests.ManagementClassTests" method="Create_Delete_Namespace" time="0" result="Skip">

        <reason><![CDATA[Condition(s) not met: \"IsElevatedAndSupportsWmi\"]]></reason>

      </test>

      <test name="System.Management.Tests.ManagementClassTests.Throw_On_Unsupported_Languages(lang: JScript)" type="System.Management.Tests.ManagementClassTests" method="Throw_On_Unsupported_Languages" time="0.0258878" result="Pass" />

      <test name="System.Management.Tests.ManagementClassTests.Throw_On_Unsupported_Languages(lang: Mcpp)" type="System.Management.Tests.ManagementClassTests" method="Throw_On_Unsupported_Languages" time="0.5057463" result="Pass" />

      <test name="System.Management.Tests.ManagementClassTests.Throw_On_Unsupported_Languages(lang: VJSharp)" type="System.Management.Tests.ManagementClassTests" method="Throw_On_Unsupported_Languages" time="0.0463371" result="Pass" />

      <test name="System.Management.Tests.ManagementClassTests.Get_SourceFile_For_Win32_Processor(lang: CSharp)" type="System.Management.Tests.ManagementClassTests" method="Get_SourceFile_For_Win32_Processor" time="1.0696575" result="Pass" />

      <test name="System.Management.Tests.ManagementClassTests.Get_SourceFile_For_Win32_Processor(lang: VB)" type="System.Management.Tests.ManagementClassTests" method="Get_SourceFile_For_Win32_Processor" time="0.1899784" result="Pass" />

      <test name="System.Management.Tests.ManagementClassTests.Get_CodeTypeDeclaration_For_Win32_LogicalDisk(includeSystemClassInClassDef: False, systemPropertyClass: False)" type="System.Management.Tests.ManagementClassTests" method="Get_CodeTypeDeclaration_For_Win32_LogicalDisk" time="0.029464" result="Pass" />

      <test name="System.Management.Tests.ManagementClassTests.Get_CodeTypeDeclaration_For_Win32_LogicalDisk(includeSystemClassInClassDef: False, systemPropertyClass: True)" type="System.Management.Tests.ManagementClassTests" method="Get_CodeTypeDeclaration_For_Win32_LogicalDisk" time="0.0069022" result="Pass" />

      <test name="System.Management.Tests.ManagementClassTests.Get_CodeTypeDeclaration_For_Win32_LogicalDisk(includeSystemClassInClassDef: True, systemPropertyClass: False)" type="System.Management.Tests.ManagementClassTests" method="Get_CodeTypeDeclaration_For_Win32_LogicalDisk" time="0.0230961" result="Pass" />

      <test name="System.Management.Tests.ManagementClassTests.Get_CodeTypeDeclaration_For_Win32_LogicalDisk(includeSystemClassInClassDef: True, systemPropertyClass: True)" type="System.Management.Tests.ManagementClassTests" method="Get_CodeTypeDeclaration_For_Win32_LogicalDisk" time="0.0057205" result="Pass" />

      <test name="System.Management.Tests.ManagementClassTests.ClassMembers_For_Win32_LogicalDisk" type="System.Management.Tests.ManagementClassTests" method="ClassMembers_For_Win32_LogicalDisk" time="0.0137378" result="Pass" />

      <test name="System.Management.Tests.ManagementClassTests.EnumerateInstances_For_Win32_LogicalDisk" type="System.Management.Tests.ManagementClassTests" method="EnumerateInstances_For_Win32_LogicalDisk" time="0.0259184" result="Pass" />

    </collection>

    <collection total="2" passed="0" failed="0" skipped="2" name="Mof Collection" time="0.000">

      <test name="System.Management.Tests.ManagementClassTestsMofRequired.Create_Modify_Delete_Static_Class" type="System.Management.Tests.ManagementClassTestsMofRequired" method="Create_Modify_Delete_Static_Class" time="0" result="Skip">

        <reason><![CDATA[Condition(s) not met: \"IsElevatedAndSupportsWmi\"]]></reason>

      </test>

      <test name="System.Management.Tests.ManagementClassTestsMofRequired.Create_Modify_Delete_Static_And_Instance" type="System.Management.Tests.ManagementClassTestsMofRequired" method="Create_Modify_Delete_Static_And_Instance" time="0" result="Skip">

        <reason><![CDATA[Condition(s) not met: \"IsElevatedAndSupportsWmi\"]]></reason>

      </test>

    </collection>

    <collection total="3" passed="2" failed="1" skipped="0" name="Test collection for System.Management.Tests.ManagementDateTimeConverterTests" time="0.304">

      <test name="System.Management.Tests.ManagementDateTimeConverterTests.TimeSpan_RoundTrip" type="System.Management.Tests.ManagementDateTimeConverterTests" method="TimeSpan_RoundTrip" time="0.101194" result="Pass" />

      <test name="System.Management.Tests.ManagementDateTimeConverterTests.DateTime_RoundTrip" type="System.Management.Tests.ManagementDateTimeConverterTests" method="DateTime_RoundTrip" time="0.17486" result="Fail">

        <failure exception-type="Xunit.Sdk.EqualException">

          <message><![CDATA[Assert.Equal() Failure\r\nExpected: 2002-04-08T16:48:35.9780000Z\r\nActual:   2002-04-08T15:48:35.9780000Z]]></message>

          <stack-trace><![CDATA[   at System.Management.Tests.ManagementDateTimeConverterTests.DateTime_RoundTrip() in C:\repos\runtime\src\libraries\System.Management\tests\System\Management\ManagementDateTimeConverterTests.cs:line 18]]></stack-trace>

        </failure>

      </test>

      <test name="System.Management.Tests.ManagementDateTimeConverterTests.DateTime_MinValue_RoundTrip" type="System.Management.Tests.ManagementDateTimeConverterTests" method="DateTime_MinValue_RoundTrip" time="0.0279173" result="Pass" />

    </collection>

    <collection total="5" passed="5" failed="0" skipped="0" name="Test collection for System.Management.Tests.SelectQueryTests" time="0.684">

      <test name="System.Management.Tests.SelectQueryTests.Select_Win32_LogicalDisk_ClassName_Condition" type="System.Management.Tests.SelectQueryTests" method="Select_Win32_LogicalDisk_ClassName_Condition" time="0.4833722" result="Pass" />

      <test name="System.Management.Tests.SelectQueryTests.Select_Win32_LogicalDisk_ClassName" type="System.Management.Tests.SelectQueryTests" method="Select_Win32_LogicalDisk_ClassName" time="0.0376493" result="Pass" />

      <test name="System.Management.Tests.SelectQueryTests.Select_All_Win32_LogicalDisk_Wql(scopeRoot: \&quot;\\\\\\\\CALOPEARM\\\\\&quot;)" type="System.Management.Tests.SelectQueryTests" method="Select_All_Win32_LogicalDisk_Wql" time="0.1065946" result="Pass" />

      <test name="System.Management.Tests.SelectQueryTests.Select_All_Win32_LogicalDisk_Wql(scopeRoot: \&quot;\\\\\\\\.\\\\\&quot;)" type="System.Management.Tests.SelectQueryTests" method="Select_All_Win32_LogicalDisk_Wql" time="0.0290099" result="Pass" />

      <test name="System.Management.Tests.SelectQueryTests.Select_All_Win32_LogicalDisk_Wql(scopeRoot: \&quot;\&quot;)" type="System.Management.Tests.SelectQueryTests" method="Select_All_Win32_LogicalDisk_Wql" time="0.027495" result="Pass" />

    </collection>

    <collection total="3" passed="2" failed="0" skipped="1" name="Test collection for System.Management.Tests.ManagementObjectTests" time="0.561">

      <test name="System.Management.Tests.ManagementObjectTests.Set_Property_Win32_ComputerSystem" type="System.Management.Tests.ManagementObjectTests" method="Set_Property_Win32_ComputerSystem" time="0.4832868" result="Pass" />

      <test name="System.Management.Tests.ManagementObjectTests.Get_Win32_LogicalDisk" type="System.Management.Tests.ManagementObjectTests" method="Get_Win32_LogicalDisk" time="0.0777272" result="Pass" />

      <test name="System.Management.Tests.ManagementObjectTests.PlatformNotSupportedException_On_Nano" type="System.Management.Tests.ManagementObjectTests" method="PlatformNotSupportedException_On_Nano" time="0" result="Skip">

        <reason><![CDATA[Condition(s) not met: \"IsWindowsNanoServer\"]]></reason>

      </test>

    </collection>

    <collection total="1" passed="1" failed="0" skipped="0" name="Test collection for System.Management.Tests.ManagementObjectSearcherTests" time="0.932">

      <test name="System.Management.Tests.ManagementObjectSearcherTests.Dynamic_Instances" type="System.Management.Tests.ManagementObjectSearcherTests" method="Dynamic_Instances" time="0.9321329" result="Pass" />

    </collection>

  </assembly>

</assemblies>

@ViktorHofer
Copy link
Member Author

Even though windows arm64 libraries don't run per PR and I can't find a way to trigger them, @carlossanlop was so kind to test it locally on his machine and the relevant tests passed. I think we can merge the PR in.

@ViktorHofer ViktorHofer merged commit 258b44f into main Mar 16, 2023
@ViktorHofer ViktorHofer deleted the SysteManagementArm64Lookup branch March 16, 2023 20:27
@ViktorHofer
Copy link
Member Author

/backport to release/6.0

@github-actions
Copy link
Contributor

Started backporting to release/6.0: https://github.com/dotnet/runtime/actions/runs/4441343949

@ViktorHofer
Copy link
Member Author

/backport to release/7.0

@github-actions
Copy link
Contributor

Started backporting to release/7.0: https://github.com/dotnet/runtime/actions/runs/4441444531

@ghost ghost locked as resolved and limited conversation to collaborators Apr 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

System.Management.dll not working on win-arm64
5 participants