Skip to content

'WindowStyle argument' test in ConsoleHost.Tests.ps1 needs to check the return value the GetWindowPlacement interop call #6871

@dantraMSFT

Description

@dantraMSFT

This test failed for nightly build ReleaseTag=6.1.0-preview.671:

[-] -WindowStyle Normal should work on Windows
[00:17:01] Expected exactly {Normal}, but got {Hidden}.

While the logged details are inconclusive, the most likely cause is the call to GetWindowPlacement in user32.dll returned FALSE.

The test should be updated to detect the return value and throw a Win32Exception with the return value of Marshal.GetLastWin32Error.

if (!GetWindowPlacement(...))
{
   int win32Error = Marshal.GetLastWin32Error();
   throw new Win32Exception(win32Error, string.Format(CultureInfo.InvariantCulture, "GetWindowPlacement failed with 0x{0:X}", win32Error));
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    In-PRIndicates that a PR is out for the issueWG-Quality-Testissues in a test or in test infrastructure

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions