microsoft / microsoft/win32metadata
CreateStreamOnHGlobal does not allow null handle
- Dominant language
- C++
- Stars
- 1.5k
- Forks
- 149
- Avg merge
- 5d 16h
- Merged PRs (30d)
- 4
Description
## Actual behavior
Calling CreateStreamOnHGlobal while passing `null` as the argument to the `SafeHandle` argument creates an ArgumentNullException at runtime, despite null being explicitly allowed in the documentation.
## Expected behavior
Passing null as the first parameter should be allowed, and function as documented.
## Repro steps
1. `NativeMethods.txt` content:
```
CreateStreamOnHGlobal
```
2. `NativeMethods.json` content (if present):
```json
```
3. Any of your own code that should be shared?
### Context
- CsWin32 version: 0.3.183
- Win32Metadata version (if explicitly set by project):
- Target Framework: net461
- `LangVersion` (if explicitly set by project): latest
Contributor guide
Research direction
Reproduce the failure using the NativeMethods.txt entry for CreateStreamOnHGlobal on the stated CsWin32 and net461 setup, then trace how its SafeHandle parameter is generated. Check NativeMethods.json if present and compare the generated behavior with the documented allowance for null; done means passing null no longer raises ArgumentNullException.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100