dotnet / dotnet/dotnet-api-docs

UnmanagedCallersOnlyAttribute.CallConvs and CallConvSuppressGCTransition

Aperta
#11,642 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
area-System.Runtime.InteropServices untriaged
Lingua principale
C#
Stelle
949
Fork
1.7k
Merge medio
2g 19h
PR unite (30g)
52

Descrizione

### Type of issue

Missing information

### Description

I find the documentation for `UnmanagedCallersOnlyAttribute.CallConvs` to be unintentionally misleading. It specifies that the valid values are `CallConv*` types. However, `CallConvSuppressGCTransition` is NOT valid value for the calling convention in this context - supressing GC transition is not allowed for reverse P/Invokes, which is the whole purpose of the `UnmanagedCallersOnlyAttribute` attribute. Moreover, the "See also" section specifically points to `CallConvSuppressGCTransition` documentation with a link to add to the confusion.

The documentation for `CallConvSuppressGCTransition` doesn't directly mention that it's only meant to be used for function pointers to unmanaged code. Instead it links to the description of the `SuppressGCTransition` attribute which lists the limitations for its use. Notably, I would be fine with the indirect link here if it was not for the documention of `UnmanagedCallersOnlyAttribute.CallConvs`. It's unreasonable to expect a documentation reader to go through two links and then read the remarks section to discover that some value combination is invalid.

### Page URL

https://learn.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.unmanagedcallersonlyattribute.callconvs?view=net-9.0#system-runtime-interopservices-unmanagedcallersonlyattribute-callconvs

### Content source URL

https://github.com/dotnet/dotnet-api-docs/blob/main/xml/System.Runtime.InteropServices/UnmanagedCallersOnlyAttribute.xml

### Document Version Independent Id

953bcf74-4793-6c98-5e89-c73dd0d748ff

### Platform Id

436c4c22-d112-467c-323f-85c5547d49db

### Article author

@dotnet-bot

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia da xml/System.Runtime.InteropServices/UnmanagedCallersOnlyAttribute.xml e verifica la documentazione di CallConvs insieme alla documentazione collegata di CallConvSuppressGCTransition. Aggiorna la formulazione e il riferimento incrociato in modo che l’utilizzo valido e la limitazione siano chiari senza richiedere ai lettori di seguire più link; il lavoro è concluso quando la documentazione dell’API non implica più che ogni tipo CallConv* sia valido qui.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
csharp
Ambito
documentation
Tipo di issue
Documentazione
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Ferma
Chiarezza
Specificata chiaramente
Idoneità per principianti
48/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.