microsoft / microsoft/CsWin32

The friendly wrapper for `NetFreeAadJoinInformation()` is pointless.

Open
#1,616 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C#
Stars
2.5k
Forks
124
Avg merge
1d 3h
Merged PRs (30d)
9

Description

Actual behavior

The generated friendly wrapper for NetFreeAadJoinInformation() is:

internal static unsafe void NetFreeAadJoinInformation([Optional] winmdroot.NetworkManagement.NetManagement.DSREG_JOIN_INFO? pJoinInfo)
{
    winmdroot.NetworkManagement.NetManagement.DSREG_JOIN_INFO pJoinInfoLocal = pJoinInfo ?? default(winmdroot.NetworkManagement.NetManagement.DSREG_JOIN_INFO);
    PInvoke.NetFreeAadJoinInformation(pJoinInfo.HasValue ? &pJoinInfoLocal : null);
}

Expected behavior

Because this P/Invoke frees pointed to memory, there shouldn't be a friendly wrapper that accepts a dereferenced instance of DSREG_JOIN_INFO.

Repro steps

  1. NativeMethods.txt content:
NetFreeAadJoinInformation
  1. NativeMethods.json content (if present): N/A

  2. Any of your own code that should be shared? N/A

Context
  • CsWin32 version: 0.3.264
  • Win32Metadata version (if explicitly set by project): N/A
  • Target Framework: net472
  • LangVersion (if explicitly set by project): N/A

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with a NativeMethods.txt entry containing NetFreeAadJoinInformation; NativeMethods.json is not needed for the stated repro. Inspect the generated friendly wrapper and the corresponding P/Invoke declaration, then verify that generation keeps the P/Invoke while omitting the pointless dereferenced-struct wrapper.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.