dotnet / dotnet/dotnet-api-docs

Modreq usage of `UnmanagedType` type should be documented

Open
#7,783 1 comment 0 reactions 0 assignees View on GitHub
area-System.Runtime.InteropServices Pri3 untriaged
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

**Issue description**

The code following C# code
```cs
public void UnmanagedT() where T : unmanaged { }
```
generates the following IL code:
```cil
.method public hidebysig
instance void UnmanagedT () cil managed
{
.param type T
.custom instance void System.Runtime.CompilerServices.IsUnmanagedAttribute::.ctor() = (
01 00 00 00
)
.maxstack 8
IL_0000: ret
}
```
which expect any compilers wanting to use the method to know that the type parameter T has to meet certain requirements.

With the `System.Runtime.CompilerServices.IsVolatile` type it is documented how & what the modreq does, it should be the same here. It would also be good if `System.Runtime.CompilerServices.IsExternalInit` (and any others missing it) got the same documentation.

I'm looking on https://docs.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.unmanagedtype?view=net-6.0.

**Target framework**

- [x] .NET Core 1.0+
- [x] .NET Framework 1.1+
- [x] .NET Standard 1.1+

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.