Altcover fails to build via dotnet run when the platform is explicitly specified in the configuration

Jarl's Avatar

Jarl

07 Mar, 2018 05:47 PM

When building for specific platforms (x86, x64, Any CPU), AltCover (an F# project, distributed as a source tree via nuget) fails to build on appveyor, instead failing with a symbol resolution error (FS0039).

This issue does not present itself if the platform is not explicitly specified.

I've included a log from one of my runs where this issue presents itself.

  1. Support Staff 1 Posted by Owen McDonnell on 08 Mar, 2018 02:23 AM

    Owen McDonnell's Avatar

    That package is having some problem with the platform environment variable that gets set for each job in the build matrix.
    A very straightforward workaround is to add this line to the 'before-build' phase,
    - ps: $env:platform = "" as i did for this build.
    This is perhaps not the most robust or ingenious solution but can at least un-block you for now.

  2. Support Staff 2 Posted by Owen McDonnell on 08 Mar, 2018 02:51 AM

    Owen McDonnell's Avatar

    I created an issue for it in the github repo for 'altcover'

  3. 3 Posted by Jarl on 08 Mar, 2018 08:55 AM

    Jarl's Avatar

    @Owen McDonnell

    That worked, insofar as I can now build and run altcover. However, testing still fails on x86 targets with a BadImageFormatException. It would seem that the 32-bit dotnet SDK isn't being used.

  4. Support Staff 4 Posted by Owen McDonnell on 09 Mar, 2018 02:09 AM

    Owen McDonnell's Avatar

    Sorry, should have realized that clearing platform variable before build would allow tests to trivially succeed. I see you corrected that mistake but ran into the coverage tool not running with appropriate dotnet version. The author of that tool gave an analysis of the problem in the issue i linked to above.
    I tried his suggestion of specifically invoking the appropriate dotnet version conditionally in the appveyor-coverage batch file in this build and was able to dodge BadImageFormatException.
    But in order to run tests i also had to add conditions to your appveyor-test.bat file like so...

    if "%PLATFORM%"=="x86" (
      "C:\Program Files (x86)\dotnet\dotnet.EXE" test --configuration %CONFIGURATION% --no-build AdvancedDLSupport.Tests
      "C:\Program Files (x86)\dotnet\dotnet.EXE" test --configuration %CONFIGURATION% --no-build Mono.DllMap.Tests
    ) 
    if "%PLATFORM%"=="x64" (
      "C:\Program Files\dotnet\dotnet.EXE" test --configuration %CONFIGURATION% --no-build AdvancedDLSupport.Tests
      "C:\Program Files\dotnet\dotnet.EXE" test --configuration %CONFIGURATION% --no-build Mono.DllMap.Tests
    )
    if "%PLATFORM%"=="Any cpu" (
      "C:\Program Files\dotnet\dotnet.EXE" test --configuration %CONFIGURATION% --no-build AdvancedDLSupport.Tests -o AdvancedDLSupport.tests/bin/Debug/netcoreapp2.0/
      "C:\Program Files\dotnet\dotnet.EXE" test --configuration %CONFIGURATION% --no-build Mono.DllMap.Tests -o Mono.DllMap.Tests/bin/Debug/netcoreapp2.0/
    )
    
  5. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 02:27 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac