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

Tests always run x64 in VS (even when selecting x86) #2926

Closed
weltkante opened this issue Feb 28, 2020 · 7 comments
Closed

Tests always run x64 in VS (even when selecting x86) #2926

weltkante opened this issue Feb 28, 2020 · 7 comments
Assignees
Labels
area-Infrastructure test-enhancement Improvements of test source code

Comments

@weltkante
Copy link
Contributor

weltkante commented Feb 28, 2020

Problem

PR #2851 will introduce tests specific to x86/x64 environments but winforms build infrastructure is broken and always runs tests in x64 when running within Visual Studio, even when explicitly selecting x86 in the VS test explorer toolbar.

Workaround

run tests from console via .\build.cmd -platform x86 -test

Root Cause / Fix

  • this was a bug in VS which has been fixed in 16.4
  • you need to update the nuget package Microsoft.Net.Test.Sdk to version 16.4 or newer
    • currently this package is pulled in by the SDK in version 16.1.1, so you either need to update the SDK or override the nuget package import
  • even when importing the package with the fix you'll still run into an error because winforms only installs the x64 sdk when running the build scripts; you also need to install the x86 sdk or VS complains
    • according to this log it looks like aspnetcore already is able to install both sdks, so you should be able to do something similar

Proof of Concept

  • edit System.Windows.Forms.Primitives.Tests.csproj and add an explicit package reference <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4" />
  • download and install the x86 sdk manually [edit] got the link wrong here and don't remember the right version to download, just download the link variation ending in x86.exe of whatever build-local.ps1 installs
  • observe that you can now run both PRINTDLGW_32_ensure_layout and PRINTDLGW_64_ensure_layout from PR fix: PrintDialog not shown #2851 inside VS (you can switch the bitness of the test runner in the test explorer toolbar)
@RussKie RussKie added area-Infrastructure test-enhancement Improvements of test source code labels Mar 3, 2020
@merriemcgaw merriemcgaw added the ⛔ blocked Blocked by external dependencies label Mar 6, 2020
@merriemcgaw merriemcgaw added this to the 5.0 milestone Mar 6, 2020
@RussKie RussKie modified the milestones: 5.0 Previews 1-4, 5.0 Apr 20, 2020
@RussKie
Copy link
Member

RussKie commented Apr 20, 2020

Thank you Tobias!

I have updated Microsoft.Net.Test.Sdk to v16.5. But I'm not sure I want to constantly pull down x86 binaries with the rate of updates we get the .NET runtime. Everyday each one of us will need to pull not just one but two bundles worth hundreds of megs... 😒

@RussKie RussKie removed the ⛔ blocked Blocked by external dependencies label Apr 20, 2020
@weltkante
Copy link
Contributor Author

maybe add a secondary script for now so its only downloaded and installed when someone needs to debug x86 tests in VS? manually finding the right link to download is always a hassle

@RussKie
Copy link
Member

RussKie commented Apr 20, 2020

Good idea!

@weltkante
Copy link
Contributor Author

with xunit.stafact updated and PR #3389 improving setup of local machines it may be possible to close this now?

workflow for setting up local x86:

  • .\restore.cmd
  • .\restore.cmd -platform x86 (fails after installing x86 runtime but you can ignore that)
  • .\build.cmd
  • .\start-vs.cmd

I can now select x86 in the test panel and tests execute

@RussKie
Copy link
Member

RussKie commented Jun 4, 2020

build.cmd does the restore as well, so you can save calling restore.cmd:

powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0eng\common\Build.ps1""" -restore %*"

powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0eng\common\Build.ps1""" -restore -build -bl %*"

Invoking commands with -platform x86 don't work - the build looks for "x86|Debug" or "x86|Release" configurations, which we don't have. I've raised dotnet/arcade#5583 for this (which also relates to this issue).

/cc: @MattGal

@weltkante
Copy link
Contributor Author

Invoking commands with -platform x86 don't work

It works enough to get the x86 runtime installed, which is all I wanted 😄

@RussKie
Copy link
Member

RussKie commented Sep 9, 2020

@weltkante do you think we can close this? I think we resolved this issue.

@RussKie RussKie removed this from the 6.0 Preview1 milestone Sep 9, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Feb 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-Infrastructure test-enhancement Improvements of test source code
Projects
None yet
Development

No branches or pull requests

4 participants