dotnet / dotnet/dotnet-api-docs

confusing wording "...verify (??) -- that the (returned parameter) is null"

Open
#1,509 0 comments 0 reactions 0 assignees View on GitHub
area-System.Runtime.InteropServices dotnet-api/prod Pri2 untriaged
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

Regarding:

>"When AcquirePointer returns, you should perform bounds checking by **_verifying_** that the pointer parameter is null. If it is not null, you must call the SafeBuffer.ReleasePointer method in a constrained execution region (CER)."

This is bizarre wording, if not incorrect. Checking for 'null' doesn't seem like a case of "bounds checking" to me.

The phrase "Verifying" that the pointer "is null" makes it sound like such could possibly be a desired outcome, but checking for null in this case means checking for an exceptional *failure*, which isn't really in the realm of "verifying," since it's not an expected condition.

---
#### Document Details

⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*

* ID: e5e96fd5-6c09-a09b-156c-5e71ff14d94b
* Version Independent ID: e37b574c-a058-633f-ab85-ff427fcfb0ef
* Content: [SafeBuffer.AcquirePointer(Byte*) Method (System.Runtime.InteropServices)](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.safebuffer.acquirepointer?view=netframework-4.7.2)
* Content Source: [xml/System.Runtime.InteropServices/SafeBuffer.xml](https://github.com/dotnet/dotnet-api-docs/blob/master/xml/System.Runtime.InteropServices/SafeBuffer.xml)
* Product: **dotnet-api**
* GitHub Login: @dotnet-bot
* Microsoft Alias: **dotnetcontent**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.