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

Fixed comparing wrong property when checking for equality #62

Merged
merged 2 commits into from
Aug 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Nefarius.Utilities.DeviceManagement.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/UserDictionary/Words/=BTHENUM/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=CANCELREMOVE/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=cfgmgr/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=classguid/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=CLASSINSTALL/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=CONFIGRET/@EntryIndexedValue">True</s:Boolean>
Expand Down
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@ Managed wrappers around SetupAPI, Cfgmgr32, NewDev and DrvStore native APIs on W

### Generating documentation

```PowerShell
dotnet build -c:Release
dotnet tool install --global Nefarius.Tools.XMLDoc2Markdown
xmldoc2md .\bin\netstandard2.0\Nefarius.Utilities.DeviceManagement.dll .\docs\
```
- `dotnet build -c:Release`
- `dotnet tool install --global Nefarius.Tools.XMLDoc2Markdown`
- `xmldoc2md .\bin\netstandard2.0\Nefarius.Utilities.DeviceManagement.dll .\docs\`

## Examples

Expand Down
6 changes: 4 additions & 2 deletions src/PnP/PnPDevice.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#nullable enable

using System;
using System.Diagnostics.CodeAnalysis;
using System.IO;
Expand Down Expand Up @@ -26,7 +27,7 @@
private readonly uint _instanceHandle;

/// <summary>
/// The <see cref="DeviceLocationFlags"/> used when creating this instance.
/// The <see cref="DeviceLocationFlags" /> used when creating this instance.
/// </summary>
private readonly DeviceLocationFlags _locationFlags;

Expand Down Expand Up @@ -188,9 +189,9 @@
return false;
}

string parentId = device.GetProperty<string>(DevicePropertyKey.Device_Parent);

Check warning on line 192 in src/PnP/PnPDevice.cs

View workflow job for this annotation

GitHub Actions / build

Converting null literal or possible null value to non-nullable type.

if (parentId.Equals(@"HTREE\ROOT\0", StringComparison.OrdinalIgnoreCase))

Check warning on line 194 in src/PnP/PnPDevice.cs

View workflow job for this annotation

GitHub Actions / build

Dereference of a possibly null reference.
{
break;
}
Expand Down Expand Up @@ -794,7 +795,8 @@
return true;
}

return string.Equals(DeviceId, other.DeviceId, StringComparison.InvariantCultureIgnoreCase);
// Instance ID distinguishes unique instances of devices, even of the same Hardware ID
return string.Equals(InstanceId, other.InstanceId, StringComparison.InvariantCultureIgnoreCase);
}

/// <inheritdoc />
Expand Down
Loading