-
Notifications
You must be signed in to change notification settings - Fork 199
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
ShellItem: Name & ParsingName Properties not filled #66
Comments
Thanks for reporting. Just to confirm, in v2.3.7 those properties returned correct values and in v3.1 they come back as empty? |
… Empty when a size not known (like as a return value from a COM object).
Nevermind. I found the problem. In trying to make string allocated with CoTaskMemAlloc more "safe", I ended up breaking the use case where you don't know the allocated size. It is fixed and will be released as part of v3.1.1 shortly. |
@dahall: On my machine, this still isn't working for ShellLibrary-Objects. Or did I get something wrong? Win 10 Pro, x64, using Vanara v3.1.7: |
I have just run the following unit test on "Any CPU", x86 and x64 with the same results. Please check your config to make sure you have v3.1.7 of Vanara.PInvoke.Shell32 and Vanara.Windows.Shell. using (var i = new ShellFolder(PInvoke.Tests.TestCaseSources.WordDoc))
{
Assert.That(i.GetDisplayName(ShellItemDisplayString.FileSysPath), Is.EqualTo(PInvoke.Tests.TestCaseSources.WordDoc).IgnoreCase);
foreach (ShellItemDisplayString e in Enum.GetValues(typeof(ShellItemDisplayString)))
Assert.That(() => TestContext.WriteLine($"{e}={i.GetDisplayName(e)}"), Throws.Nothing);
Assert.That(i.GetDisplayName((ShellItemDisplayString)0x8fffffff), Is.EqualTo(i.GetDisplayName(0)));
}
using (var i = new ShellFolder(PInvoke.Tests.TestCaseSources.TempDir))
{
Assert.That(i.GetDisplayName(ShellItemDisplayString.FileSysPath), Is.EqualTo(PInvoke.Tests.TestCaseSources.TempDir).IgnoreCase);
foreach (ShellItemDisplayString e in Enum.GetValues(typeof(ShellItemDisplayString)))
Assert.That(() => TestContext.WriteLine($"{e}={i.GetDisplayName(e)}"), Throws.Nothing);
Assert.That(i.GetDisplayName((ShellItemDisplayString)0x8fffffff), Is.EqualTo(i.GetDisplayName(0)));
}
using (var i = new ShellFolder(KNOWNFOLDERID.FOLDERID_DocumentsLibrary))
{
foreach (ShellItemDisplayString e in Enum.GetValues(typeof(ShellItemDisplayString)))
Assert.That(() => TestContext.WriteLine($"{e}={i.GetDisplayName(e)}"), Throws.Nothing);
Assert.That(i.GetDisplayName((ShellItemDisplayString)0x8fffffff), Is.EqualTo(i.GetDisplayName(0)));
} Output
|
Hi, David, thanks for your quick reply. Perhaps I just misunderstood the Name property, but here's what I'm doing: var libfolder = new ShellFolder(KNOWNFOLDERID.FOLDERID_Libraries);
var libraries = libfolder.EnumerateChildren(FolderItemFilter.Folders);
Console.WriteLine($"Enumerating '{ libfolder.Name }'");
foreach (var libitm in libraries)
Console.WriteLine($"Current LibItem.Name: '{ libitm.Name } ' " +
$"having DisplayName: ' { libitm.GetDisplayName(ShellItemDisplayString.ParentRelative) }'"); This leads to the following output:
So, yes, using Thanks in advance, |
The |
Hi, David,
Describe the bug
I just migrated my packages from v2.7 to 3.1, where I'm using the
Vanara.Windows.Shell
-package. Using the good old ShellItems I can't retrieve theirName
andDisplayName
respectively which seem always to be null.What code is involved
Vanara.Windows.Shell.ShellItem
-ObjectsExpected behavior
After having created an
Vanara.Windows.Shell.ShellItem
, I expected to have bothName
andParsingName
filled to use them for Display and Parsing them.For FileSystem-Objects, I could use the FileInfo, for virtual Items like Libraries this won't work of course. However, even calling
GetDisplayName
returns NULL, see screenie.Is there something I've missed, or may this be a bug?
Thanks in advance, regards,
tajbender
Screenshots
The text was updated successfully, but these errors were encountered: