Skip to content

Commit

Permalink
Replaced GitVersion with MinVer
Browse files Browse the repository at this point in the history
Added nullable annotation where applicable
  • Loading branch information
nefarius committed Mar 11, 2024
1 parent b6d1c08 commit 92fdfa2
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 15 deletions.
6 changes: 0 additions & 6 deletions GitVersion.yml

This file was deleted.

1 change: 0 additions & 1 deletion Nefarius.Utilities.DeviceManagement.sln
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{9473D630-747A-4F52-B42F-DE3EA1FEACD0}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
appveyor.yml = appveyor.yml
README.md = README.md
Directory.Build.props = Directory.Build.props
EndProjectSection
Expand Down
12 changes: 8 additions & 4 deletions src/Nefarius.Utilities.DeviceManagement.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
<Description>Managed wrappers around SetupAPI, Cfgmgr32, NewDev and DrvStore native APIs on Windows.</Description>
</PropertyGroup>

<PropertyGroup>
<MinVerTagPrefix>v</MinVerTagPrefix>
</PropertyGroup>

<ItemGroup>
<Compile Remove="Generator\**" />
<Compile Remove="Tests\**" />
Expand All @@ -20,14 +24,14 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="GitVersion.MsBuild" Version="5.12.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" />
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.2.229-beta">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="MinVer" Version="5.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/PnP/IPnPDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public interface IPnPDevice
/// <param name="propertyKey">The <see cref="DevicePropertyKey" /> to query for.</param>
/// <returns>On success, the value of the queried property.</returns>
/// <remarks>If the queried property doesn't exist, the default value of the managed type is returned.</remarks>
T GetProperty<T>(DevicePropertyKey propertyKey);
T? GetProperty<T>(DevicePropertyKey propertyKey);

/// <summary>
/// Creates or updates an existing property with a given value.
Expand Down
7 changes: 4 additions & 3 deletions src/PnP/PnPDevice.Properties.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
#nullable enable
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
Expand Down Expand Up @@ -52,7 +53,7 @@ public partial class PnPDevice
/// <param name="propertyKey">The <see cref="DevicePropertyKey" /> to query for.</param>
/// <returns>On success, the value of the queried property.</returns>
/// <remarks>If the queried property doesn't exist, the default value of the managed type is returned.</remarks>
public T GetProperty<T>(DevicePropertyKey propertyKey)
public T? GetProperty<T>(DevicePropertyKey propertyKey)
{
if (typeof(T) != propertyKey.PropertyType)
{
Expand Down Expand Up @@ -114,7 +115,7 @@ public T GetProperty<T>(DevicePropertyKey propertyKey)
// Regular strings
if (managedType == typeof(string))
{
string value = Marshal.PtrToStringUni(buffer);
string? value = Marshal.PtrToStringUni(buffer);
return (T)Convert.ChangeType(value, typeof(T));
}

Expand Down

0 comments on commit 92fdfa2

Please sign in to comment.