Skip to content

CM_Locate_DevNode does not generate friendly overload #1710

Open

Description

Actual behavior

CM_Locate_DevNode does not generate Span or string overload for second parameter ([Optional] winmdroot.Foundation.PWSTR pDeviceID).

Expected behavior

Generating overloads like:
internal static extern unsafe winmdroot.Devices.DeviceAndDriverInstallation.CONFIGRET CM_Locate_DevNode(out uint pdnDevInst, [Optional] Span pDeviceID, winmdroot.Devices.DeviceAndDriverInstallation.CM_LOCATE_DEVNODE_FLAGS ulFlags);

or

internal static extern unsafe winmdroot.Devices.DeviceAndDriverInstallation.CONFIGRET CM_Locate_DevNode(out uint pdnDevInst, [Optional] string pDeviceID, winmdroot.Devices.DeviceAndDriverInstallation.CM_LOCATE_DEVNODE_FLAGS ulFlags);

Maybe this is expected behaviour. In that case, what is the best way to handle my task - passing string to this method?

Repro steps

  1. NativeMethods.txt content:
CM_Locate_DevNode
  1. NativeMethods.json content (if present):
  1. Any of your own code that should be shared?

Context

  • CsWin32 version: 0.3.275
  • Win32Metadata version (if explicitly set by project):
  • Target Framework: net10.0
  • LangVersion (if explicitly set by project): [e.g. 9]

Activity

  1. added
    bug
    on Jun 2, 2026
  2. littletoxic commented on Jun 5, 2026

    @littletoxic
    Contributor

    This looks like a metadata issue. pDeviceID should probably be marked [Const].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions