Remove the property disabling optimization (#19701)

This commit is contained in:
Patrick Meinecke 2023-06-05 19:45:11 -04:00 committed by GitHub
parent b77d51062f
commit cc05fdead2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 11 deletions

View File

@ -185,14 +185,6 @@
<DebugType>full</DebugType>
</PropertyGroup>
<!-- Define non-windows, release configuration properties -->
<PropertyGroup Condition=" '$(Configuration)' == 'Release' And '$(IsWindows)' != 'true' ">
<!-- Set-Date fails with optimize enabled in NonWindowsSetDate
Debugging the issues resolves the problem
-->
<Optimize>false</Optimize>
</PropertyGroup>
<PropertyGroup>
<Features>strict</Features>
</PropertyGroup>

View File

@ -932,8 +932,10 @@ namespace System.Management.Automation
[LibraryImport(psLib)]
internal static partial int WaitPid(int pid, [MarshalAs(UnmanagedType.Bool)] bool nohang);
// This is a struct tm from <time.h>.
[StructLayout(LayoutKind.Sequential)]
// This is the struct `private_tm` from setdate.h in libpsl-native.
// Packing is set to 4 to match the unmanaged declaration.
// https://github.com/PowerShell/PowerShell-Native/blob/c5575ceb064e60355b9fee33eabae6c6d2708d14/src/libpsl-native/src/setdate.h#L23
[StructLayout(LayoutKind.Sequential, Pack = 4)]
internal unsafe struct UnixTm
{
/// <summary>Seconds (0-60).</summary>
@ -980,7 +982,7 @@ namespace System.Management.Automation
return tm;
}
[LibraryImport(psLib)]
[LibraryImport(psLib, SetLastError = true)]
internal static unsafe partial int SetDate(UnixTm* tm);
[LibraryImport(psLib, StringMarshalling = StringMarshalling.Utf8)]