Skip to content

Commit

Permalink
Update to .NET 8
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremyKuhne committed Nov 14, 2023
1 parent 6b9e3c4 commit 2f7ca83
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 18 deletions.
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<!-- Input Directories -->
<PackagesDir Condition="'$(PackagesDir)'==''">$(RepoDir)packages\</PackagesDir>

<TargetFramework>net7.0-windows</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

Expand Down Expand Up @@ -66,7 +66,7 @@

<!-- Other settings -->
<PropertyGroup>
<LangVersion>11.0</LangVersion>
<LangVersion>12.0</LangVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/thirtytwo/ProcessAndThreads/ProcessInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public ProcessInfo()
public Enumerator GetEnumerator() => new(this);

private SYSTEM_PROCESS_INFORMATION* First
=> (SYSTEM_PROCESS_INFORMATION*)Unsafe.AsPointer(ref Unsafe.AsRef(_buffer[0]));
=> (SYSTEM_PROCESS_INFORMATION*)Unsafe.AsPointer(ref Unsafe.AsRef(ref _buffer[0]));

public int Count => _count;

Expand Down
4 changes: 2 additions & 2 deletions src/thirtytwo/Support/StringParameterArray.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ public StringParameterArray(string[]? values)

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator char**(in StringParameterArray array)
=> array._param is null ? null : (char**)Unsafe.AsPointer(ref Unsafe.AsRef(array._param[0]));
=> array._param is null ? null : (char**)Unsafe.AsPointer(ref Unsafe.AsRef(ref array._param[0]));

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator sbyte**(in StringParameterArray array)
=> array._param is null ? null : (sbyte**)Unsafe.AsPointer(ref Unsafe.AsRef(array._param[0]));
=> array._param is null ? null : (sbyte**)Unsafe.AsPointer(ref Unsafe.AsRef(ref array._param[0]));

public void Dispose()
{
Expand Down
2 changes: 1 addition & 1 deletion src/thirtytwo/Win32/Foundation/BSTR.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public BSTR(string value) : this((char*)Marshal.StringToBSTR(value))
public void Dispose()
{
Marshal.FreeBSTR((nint)Value);
Unsafe.AsRef(this) = default;
Unsafe.AsRef(in this) = default;
}

public string ToStringAndFree()
Expand Down
2 changes: 1 addition & 1 deletion src/thirtytwo/Win32/Foundation/HANDLE.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ public unsafe void Dispose()
Interop.CloseHandle(this).ThrowLastErrorIfFalse();
}

Unsafe.AsRef(this) = default;
Unsafe.AsRef(in this) = default;
}
}
4 changes: 3 additions & 1 deletion src/thirtytwo/Win32/Foundation/PCWSTR.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@

namespace Windows.Win32.Foundation;

#pragma warning disable CA2231 // Overload operator equals on overriding value type Equals
public unsafe partial struct PCWSTR
#pragma warning restore CA2231
{
public bool IsNull => Value is null;

Expand All @@ -14,7 +16,7 @@ public void LocalFree()
if (Value is not null)
{
Interop.LocalFree((HLOCAL)(nint)Value);
Unsafe.AsRef(this) = default;
Unsafe.AsRef(in this) = default;
}
}
}
2 changes: 1 addition & 1 deletion src/thirtytwo/Win32/Foundation/PWSTR.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public void LocalFree()
if (Value is not null)
{
Interop.LocalFree((HLOCAL)(nint)Value);
Unsafe.AsRef(this) = default;
Unsafe.AsRef(in this) = default;
}
}
}
2 changes: 1 addition & 1 deletion src/thirtytwo/Win32/Graphics/Gdi/HFONT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,6 @@ public void Dispose()
Interop.DeleteObject(this);
}

Unsafe.AsRef(this) = default;
Unsafe.AsRef(in this) = default;
}
}
2 changes: 1 addition & 1 deletion src/thirtytwo/Win32/Graphics/Gdi/HRGN.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public void Dispose()
Interop.DeleteObject(this);
}

Unsafe.AsRef(this) = default;
Unsafe.AsRef(in this) = default;
}

public static HRGN FromRectangle(Rectangle rectangle)
Expand Down
4 changes: 2 additions & 2 deletions src/thirtytwo/Win32/System/Com/ComScope.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ namespace Windows.Win32.System.Com;
public static implicit operator nint(in ComScope<T> scope) => scope._value;

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator T**(in ComScope<T> scope) => (T**)Unsafe.AsPointer(ref Unsafe.AsRef(scope._value));
public static implicit operator T**(in ComScope<T> scope) => (T**)Unsafe.AsPointer(ref Unsafe.AsRef(in scope._value));

[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static implicit operator void**(in ComScope<T> scope) => (void**)Unsafe.AsPointer(ref Unsafe.AsRef(scope._value));
public static implicit operator void**(in ComScope<T> scope) => (void**)Unsafe.AsPointer(ref Unsafe.AsRef(in scope._value));

public bool IsNull => _value == 0;

Expand Down
2 changes: 1 addition & 1 deletion src/thirtytwo/Win32/UI/WindowsAndMessaging/HICON.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,6 @@ public void Dispose()
Interop.DestroyIcon(this);
}

Unsafe.AsRef(this) = default;
Unsafe.AsRef(in this) = default;
}
}
4 changes: 0 additions & 4 deletions src/thirtytwo_tests/thirtytwo_tests.csproj
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0-windows7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>

<RootNamespace>Windows</RootNamespace>

<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
</PropertyGroup>

Expand Down

0 comments on commit 2f7ca83

Please sign in to comment.