Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HANDLE* parameters should not be annotated [In, Out] #139

Closed
AArnott opened this issue Jan 20, 2021 · 0 comments
Closed

HANDLE* parameters should not be annotated [In, Out] #139

AArnott opened this issue Jan 20, 2021 · 0 comments
Labels
usability Touch-up to improve the user experience for a language projection

Comments

@AArnott
Copy link
Member

AArnott commented Jan 20, 2021

Several methods take pointers to handle structs and are annotated with [In, Out] even though they only ever read from these pointers. Can these annotations be modified to just [In] where it is safe to do so?

Here is a list of suspect APIs (as they appear in a list of warnings due to this characteristic):

Test Name:	GeneratorTests.FullGeneration
Test Outcome:	Failed
Result Message:	
Assert.Empty() Failure
Collection: [DXVAHDSW_CALLBACKS.cs(32,107): error CS0208: Cannot take the address of, get the size of, or declare a pointer to a managed type ('CloseHandleSafeHandle'), DXVAHDSW_CALLBACKS.cs(59,123): error CS0208: Cannot take the address of, get the size of, or declare a pointer to a managed type ('CloseHandleSafeHandle'), PInvoke.Kernel32.cs(2709,32): error CS0246: The type or namespace name 'ClosePrivateNamespaceSafeHandle' could not be found (are you missing a using directive or an assembly reference?), PInvoke.Kernel32.cs(2718,39): error CS0246: The type or namespace name 'ClosePrivateNamespaceSafeHandle' could not be found (are you missing a using directive or an assembly reference?), DsGetDcCloseWSafeHandle.cs(46,34): error CS1503: Argument 1: cannot convert from 'Microsoft.Windows.Sdk.HANDLE' to 'Microsoft.Windows.Sdk.CloseHandleSafeHandle', ...]
Result StandardOutput:	
DXVAHDSW_CALLBACKS.cs(32,107): error CS0208: Cannot take the address of, get the size of, or declare a pointer to a managed type ('CloseHandleSafeHandle')
DXVAHDSW_CALLBACKS.cs(59,123): error CS0208: Cannot take the address of, get the size of, or declare a pointer to a managed type ('CloseHandleSafeHandle')
PInvoke.Kernel32.cs(2709,32): error CS0246: The type or namespace name 'ClosePrivateNamespaceSafeHandle' could not be found (are you missing a using directive or an assembly reference?)
PInvoke.Kernel32.cs(2718,39): error CS0246: The type or namespace name 'ClosePrivateNamespaceSafeHandle' could not be found (are you missing a using directive or an assembly reference?)
DsGetDcCloseWSafeHandle.cs(46,34): error CS1503: Argument 1: cannot convert from 'Microsoft.Windows.Sdk.HANDLE' to 'Microsoft.Windows.Sdk.CloseHandleSafeHandle'
PInvoke.t2embed.cs(426,33): warning CS1574: XML comment has cref attribute 'TTGetNewFontName(CloseHandleSafeHandle, char *, int, byte *, int)' that could not be resolved
PInvoke.NetApi32.cs(1253,33): warning CS1574: XML comment has cref attribute 'DavAddConnection(CloseHandleSafeHandle, char *, char *, char *, byte *, uint)' that could not be resolved
PInvoke.IPHlpApi.cs(656,33): warning CS1574: XML comment has cref attribute 'NotifyStableUnicastIpAddressTable(ushort, MIB_UNICASTIPADDRESS_TABLE**, PSTABLE_UNICAST_IPADDRESS_TABLE_CALLBACK, void *, CloseHandleSafeHandle)' that could not be resolved
PInvoke.Ole32.cs(1805,33): warning CS1574: XML comment has cref attribute 'HBITMAP_UserSize(uint *, uint, DeleteObjectSafeHandle)' that could not be resolved
PInvoke.Ole32.cs(1816,33): warning CS1574: XML comment has cref attribute 'HBITMAP_UserMarshal(uint *, byte *, DeleteObjectSafeHandle)' that could not be resolved
PInvoke.Ole32.cs(1846,33): warning CS1574: XML comment has cref attribute 'HBITMAP_UserFree(uint *, DeleteObjectSafeHandle)' that could not be resolved
PInvoke.Ole32.cs(1857,33): warning CS1574: XML comment has cref attribute 'HDC_UserSize(uint *, uint, DeleteDCSafeHandle)' that could not be resolved
PInvoke.Ole32.cs(1868,33): warning CS1574: XML comment has cref attribute 'HDC_UserMarshal(uint *, byte *, DeleteDCSafeHandle)' that could not be resolved
PInvoke.Ole32.cs(1898,33): warning CS1574: XML comment has cref attribute 'HDC_UserFree(uint *, DeleteDCSafeHandle)' that could not be resolved
PInvoke.Ole32.cs(1909,33): warning CS1574: XML comment has cref attribute 'HICON_UserSize(uint *, uint, DestroyIconSafeHandle)' that could not be resolved
PInvoke.Ole32.cs(1920,33): warning CS1574: XML comment has cref attribute 'HICON_UserMarshal(uint *, byte *, DestroyIconSafeHandle)' that could not be resolved
PInvoke.Ole32.cs(1950,33): warning CS1574: XML comment has cref attribute 'HICON_UserFree(uint *, DestroyIconSafeHandle)' that could not be resolved
PInvoke.Ole32.cs(2089,33): warning CS1574: XML comment has cref attribute 'HBITMAP_UserSize64(uint *, uint, DeleteObjectSafeHandle)' that could not be resolved
PInvoke.Ole32.cs(2100,33): warning CS1574: XML comment has cref attribute 'HBITMAP_UserMarshal64(uint *, byte *, DeleteObjectSafeHandle)' that could not be resolved
PInvoke.Ole32.cs(2130,33): warning CS1574: XML comment has cref attribute 'HBITMAP_UserFree64(uint *, DeleteObjectSafeHandle)' that could not be resolved
PInvoke.Ole32.cs(2141,33): warning CS1574: XML comment has cref attribute 'HDC_UserSize64(uint *, uint, DeleteDCSafeHandle)' that could not be resolved
PInvoke.Ole32.cs(2152,33): warning CS1574: XML comment has cref attribute 'HDC_UserMarshal64(uint *, byte *, DeleteDCSafeHandle)' that could not be resolved
PInvoke.Ole32.cs(2182,33): warning CS1574: XML comment has cref attribute 'HDC_UserFree64(uint *, DeleteDCSafeHandle)' that could not be resolved
PInvoke.Ole32.cs(2193,33): warning CS1574: XML comment has cref attribute 'HICON_UserSize64(uint *, uint, DestroyIconSafeHandle)' that could not be resolved
PInvoke.Ole32.cs(2204,33): warning CS1574: XML comment has cref attribute 'HICON_UserMarshal64(uint *, byte *, DestroyIconSafeHandle)' that could not be resolved
PInvoke.Ole32.cs(2234,33): warning CS1574: XML comment has cref attribute 'HICON_UserFree64(uint *, DestroyIconSafeHandle)' that could not be resolved
PInvoke.Ole32.cs(2309,33): warning CS1574: XML comment has cref attribute 'HACCEL_UserSize(uint *, uint, DestroyAcceleratorTableSafeHandle)' that could not be resolved
PInvoke.Ole32.cs(2320,33): warning CS1574: XML comment has cref attribute 'HACCEL_UserMarshal(uint *, byte *, DestroyAcceleratorTableSafeHandle)' that could not be resolved
PInvoke.Ole32.cs(2350,33): warning CS1574: XML comment has cref attribute 'HACCEL_UserFree(uint *, DestroyAcceleratorTableSafeHandle)' that could not be resolved
PInvoke.Ole32.cs(2425,33): warning CS1574: XML comment has cref attribute 'HMENU_UserSize(uint *, uint, DestroyMenuSafeHandle)' that could not be resolved
PInvoke.Ole32.cs(2436,33): warning CS1574: XML comment has cref attribute 'HMENU_UserMarshal(uint *, byte *, DestroyMenuSafeHandle)' that could not be resolved
PInvoke.Ole32.cs(2466,33): warning CS1574: XML comment has cref attribute 'HMENU_UserFree(uint *, DestroyMenuSafeHandle)' that could not be resolved
PInvoke.Ole32.cs(2477,33): warning CS1574: XML comment has cref attribute 'HACCEL_UserSize64(uint *, uint, DestroyAcceleratorTableSafeHandle)' that could not be resolved
PInvoke.Ole32.cs(2488,33): warning CS1574: XML comment has cref attribute 'HACCEL_UserMarshal64(uint *, byte *, DestroyAcceleratorTableSafeHandle)' that could not be resolved
PInvoke.Ole32.cs(2518,33): warning CS1574: XML comment has cref attribute 'HACCEL_UserFree64(uint *, DestroyAcceleratorTableSafeHandle)' that could not be resolved
PInvoke.Ole32.cs(2593,33): warning CS1574: XML comment has cref attribute 'HMENU_UserSize64(uint *, uint, DestroyMenuSafeHandle)' that could not be resolved
PInvoke.Ole32.cs(2604,33): warning CS1574: XML comment has cref attribute 'HMENU_UserMarshal64(uint *, byte *, DestroyMenuSafeHandle)' that could not be resolved
PInvoke.Ole32.cs(2634,33): warning CS1574: XML comment has cref attribute 'HMENU_UserFree64(uint *, DestroyMenuSafeHandle)' that could not be resolved
PInvoke.Ole32.cs(3948,33): warning CS1574: XML comment has cref attribute 'HPALETTE_UserSize(uint *, uint, DeleteObjectSafeHandle)' that could not be resolved
PInvoke.Ole32.cs(3959,33): warning CS1574: XML comment has cref attribute 'HPALETTE_UserMarshal(uint *, byte *, DeleteObjectSafeHandle)' that could not be resolved
PInvoke.Ole32.cs(3989,33): warning CS1574: XML comment has cref attribute 'HPALETTE_UserFree(uint *, DeleteObjectSafeHandle)' that could not be resolved
PInvoke.Ole32.cs(4000,33): warning CS1574: XML comment has cref attribute 'HRGN_UserSize(uint *, uint, DeleteObjectSafeHandle)' that could not be resolved
PInvoke.Ole32.cs(4011,33): warning CS1574: XML comment has cref attribute 'HRGN_UserMarshal(uint *, byte *, DeleteObjectSafeHandle)' that could not be resolved
PInvoke.Ole32.cs(4041,33): warning CS1574: XML comment has cref attribute 'HRGN_UserFree(uint *, DeleteObjectSafeHandle)' that could not be resolved
PInvoke.Ole32.cs(4052,33): warning CS1574: XML comment has cref attribute 'HPALETTE_UserSize64(uint *, uint, DeleteObjectSafeHandle)' that could not be resolved
PInvoke.Ole32.cs(4063,33): warning CS1574: XML comment has cref attribute 'HPALETTE_UserMarshal64(uint *, byte *, DeleteObjectSafeHandle)' that could not be resolved
PInvoke.Ole32.cs(4093,33): warning CS1574: XML comment has cref attribute 'HPALETTE_UserFree64(uint *, DeleteObjectSafeHandle)' that could not be resolved
PInvoke.OleAut32.cs(34,33): warning CS1574: XML comment has cref attribute 'BSTR_UserSize(uint *, uint, SysFreeStringSafeHandle)' that could not be resolved
PInvoke.OleAut32.cs(50,33): warning CS1574: XML comment has cref attribute 'BSTR_UserMarshal(uint *, byte *, SysFreeStringSafeHandle)' that could not be resolved
PInvoke.OleAut32.cs(94,33): warning CS1574: XML comment has cref attribute 'BSTR_UserFree(uint *, SysFreeStringSafeHandle)' that could not be resolved
PInvoke.OleAut32.cs(200,33): warning CS1574: XML comment has cref attribute 'BSTR_UserSize64(uint *, uint, SysFreeStringSafeHandle)' that could not be resolved
PInvoke.OleAut32.cs(216,33): warning CS1574: XML comment has cref attribute 'BSTR_UserMarshal64(uint *, byte *, SysFreeStringSafeHandle)' that could not be resolved
PInvoke.OleAut32.cs(260,33): warning CS1574: XML comment has cref attribute 'BSTR_UserFree64(uint *, SysFreeStringSafeHandle)' that could not be resolved
PInvoke.OleAut32.cs(628,33): warning CS1574: XML comment has cref attribute 'SysReAllocString(SysFreeStringSafeHandle, ushort *)' that could not be resolved
PInvoke.OleAut32.cs(665,33): warning CS1574: XML comment has cref attribute 'SysReAllocStringLen(SysFreeStringSafeHandle, ushort *, uint)' that could not be resolved
@AArnott AArnott added the usability Touch-up to improve the user experience for a language projection label Jan 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
usability Touch-up to improve the user experience for a language projection
Projects
None yet
Development

No branches or pull requests

1 participant