Get File Thumbnail and Icon through Shell

In c# we can easily get a file thumbnail of any file (not just images) using shell.
One of the ways I have been doing it in my desktop software is

HResult result1 = ((IShellItemImageFactory)ppsi).GetImage(new SIZE(resolution, resolution), SIIGBF.SIIGBF_BIGGERSIZEOK | SIIGBF.SIIGBF_THUMBNAILONLY, out hbitmap);

or for icons

var shInfo = Shell32.GetFileIcon(path, Shell32.FileAttributes.Icon);

Unity does not report any errors but just crashes the editor once it reaches those lines.

Is that even possible in Unity? I do plan to target only desktop computers.

Do you have a crash log/editor log from when it crashes?