You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PrivateExtractIcons is failing because nIcons is set to zero, the only way to set it to a valid value is to use the "unmanaged" method overload (that uses unsafe pointers). I don't know why nIcons isn't part of the managed function signature.
In this screenshot, there's a call visible done by a referenced DLL (shell32.dll) that calls the function correctly, while the .NET runtime (user code, coreclr.dll) is calling the function with nIcons set to 0 (also causing the entry to be highlighted as yellow indicating an error).
Expected behavior
To have uint nIcons inside the method overload using managed objects:
The parameter is removed from the friendly overload because it can be inferred from the length of the phicon array.
However the metadata is buggy for this method. It claims that both phicon and piconid are arrays, both of which have a length set by nIcons. But per the docspiconid is not an array at all.
When the metadata is fixed, the missing parameter in the friendly overload will still be missing, but you'll be able to set its value by allocating the proper span for the phicon argument.
AArnott
changed the title
Safe method overload for PrivateExtractIconsW is missing parameter nIcons
PrivateExtractIcons method incorrectly claims two pointer parameters are arrays
Aug 18, 2021
AArnott
changed the title
PrivateExtractIcons method incorrectly claims two pointer parameters are arrays
PrivateExtractIcons method incorrectly claims piconid parameter is an array
Aug 18, 2021
Actual behavior
PrivateExtractIcons
is failing becausenIcons
is set to zero, the only way to set it to a valid value is to use the "unmanaged" method overload (that uses unsafe pointers). I don't know whynIcons
isn't part of the managed function signature.In this screenshot, there's a call visible done by a referenced DLL (
shell32.dll
) that calls the function correctly, while the .NET runtime (user code,coreclr.dll
) is calling the function withnIcons
set to0
(also causing the entry to be highlighted as yellow indicating an error).Expected behavior
To have
uint nIcons
inside the method overload using managed objects:Repro steps
NativeMethods.txt
content:In this example
hIcon
isNULL
and the result is also 0, indicating this function did nothing or has failed.Context
0.1.506-beta
net5.0-windows
The text was updated successfully, but these errors were encountered: