-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Labels
area-System.Runtime.InteropServicesgood first issueIssue should be easy to implement, good for first-time contributorsIssue should be easy to implement, good for first-time contributorshelp wanted[up-for-grabs] Good issue for external contributors[up-for-grabs] Good issue for external contributors
Milestone
Description
In PR #81480, the following P/Invoke was failing to compile when targeting .NET 8.
runtime/src/libraries/Common/tests/TestUtilities/System/WindowsIdentityFixture.cs
Lines 121 to 122 in 1671125
| [LibraryImport("netapi32.dll", SetLastError = true)] | |
| internal static partial uint NetUserAdd([MarshalAs(UnmanagedType.LPWStr)] string servername, uint level, ref USER_INFO_1 buf, out uint parm_err); |
The failure is because in the current dotnet/runtime official build this P/Invoke is only compiled to target .NET 6 and so the LibraryImport source generated degrades to a DllImport. We should provide a custom marshaller for the struct below
runtime/src/libraries/Common/tests/TestUtilities/System/WindowsIdentityFixture.cs
Lines 127 to 138 in 1671125
| [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] | |
| internal struct USER_INFO_1 | |
| { | |
| public string usri1_name; | |
| public string usri1_password; | |
| public uint usri1_password_age; | |
| public uint usri1_priv; | |
| public string usri1_home_dir; | |
| public string usri1_comment; | |
| public uint usri1_flags; | |
| public string usri1_script_path; | |
| } |
This scenario could be made to "just work" with the following issue addressed: #81656
Metadata
Metadata
Assignees
Labels
area-System.Runtime.InteropServicesgood first issueIssue should be easy to implement, good for first-time contributorsIssue should be easy to implement, good for first-time contributorshelp wanted[up-for-grabs] Good issue for external contributors[up-for-grabs] Good issue for external contributors