microsoft / microsoft/CsWin32

Managed delegates in DNS_QUERY_REQUEST makes DnsQueryEx unusable with other struct versions (e.g. DNS_QUERY_REQUEST3)

Open
#1,042 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Is your feature request related to a problem? Please describe.
CsWin32 currently doesn't support DnsQueryEx() with DNS_QUERY_REQUEST3 struct because DnsQueryEx() is getting an in parameter instead of a pointer parameter is that DNS_QUERY_REQUEST3 is detected to be a managed type because one of its fields (pQueryCompletionCallback) is a delegate. One cannot take a pointer to a struct with a delegate typed field. This leaves use the options to either setting allowMarshaling:off on a project level which cause additional errors because some other delegate type needs to be changed to pointer type or declaring our own DnsQueryEx() extern method.

Describe the solution you'd like
It would be great if we can selectively choose certain APIs to set allowMarshaling:off.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

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

Start with the DnsQueryEx API and the DNS_QUERY_REQUEST3 structure described in the issue, then trace how CsWin32 detects managed fields and applies allowMarshaling. Identify the existing tests for generated signatures and add coverage for selectively disabling marshaling on this API. Done means DnsQueryEx can use the relevant struct pointer while other generated delegate types retain their current behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.