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

Incorrect "by value" comments in PInvoke/Ole/Ole32/PropIdl.PROPVARIANT.cs PROPVARIANT structure #497

Open
CodeSetting opened this issue Dec 22, 2024 · 0 comments

Comments

@CodeSetting
Copy link

First, let me thank you for this truly astonishing NuGet package!

I only wish I had discovered it a long time ago and saved myself countless hours of similar effort. That said, while exploring this extensive package, I did come across one minor documentation/commenting mistake.

In the PInvoke/Ole/Ole32/PropIdl.PROPVARIANT.cs module, in the PROPVARIANT structure, I believe there are a series of inaccurate comments. Specifically, these comments include the text "by value", which I believe should actually read "by reference".

As one example, among many instances, we see the following comment and field:

/// <summary>Gets the "by value" byte value.</summary>
public byte? pbVal => GetRawValue<byte>();

Elsewhere in the same module, where the pbVal field is used, we see the following code. From this code, we can see it is clearly a "by reference" byte value (see isRef/VARTYPE.VT_BYREF):

var isRef = vt.IsFlagSet(VARTYPE.VT_BYREF);
var elemType = (VARTYPE)((int)vt & 0xFFF);
return elemType switch
{
  .
  .
  .
  VARTYPE.VT_UI1 => isRef ? pbVal : (isVector ? caub : bVal),

Thanks again for your amazing work! I look forward to continuing to explore this package.

Also, as I integrate it into my projects, I look forward to jettisoning a metric ton of similar P/Invoke code I wrote.

@CodeSetting CodeSetting changed the title Incorrect "is value" comments in PInvoke/Ole/Ole32/PropIdl.PROPVARIANT.cs PROPVARIANT structure Incorrect "by value" comments in PInvoke/Ole/Ole32/PropIdl.PROPVARIANT.cs PROPVARIANT structure Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant