Giter Club home page Giter Club logo

Comments (9)

SteveGilham avatar SteveGilham commented on August 25, 2024 1

The latest release, 2.0.324 has the changes in the project files to build without having to clear %Platform%; and I've taken the results of working with just the x86 runtime (and not the SDK) on the AppVeyor default build machine, and written them up as a wiki page.

It boils down to -- if you can get your tests to run without the coverage gathering, then you're good. It is possible to inject either and x86 or an AnyCPU recording assembly into the system under test by pre-building altcover appropriately then running rather than as a build+run in one step; and whichever you've built should work to drive the coverage collection in runner mode.

from altcover.

SteveGilham avatar SteveGilham commented on August 25, 2024

Interesting. The failure

[00:03:53] C:\projects\advancedlsupport\altcover\altcover.1.6.230\tools\netcoreapp2.0\AltCover\Runner.fs(142,34): error FS0039: The value, constructor, namespace or type 'Base' is not defined. [C:\projects\advancedlsupport\altcover\altcover.1.6.230\tools\netcoreapp2.0\AltCover\altcover.core.fsproj]

says that it's failing to find code from a file that is shared and linked into the main program by relative path.

from altcover.

SteveGilham avatar SteveGilham commented on August 25, 2024

I've repro'd the problem, including the subsequent x86 image format issue; and clearing the platform (and letting it default to AnyCPU) is the best work-round for the moment.

from altcover.

SteveGilham avatar SteveGilham commented on August 25, 2024

Analysis:
Different bitness is a dimension that slipped through my test set.

  • The shared code uses a compilation constant to distinguish between whether it's in the main program (CLR4 in the full framework) or the recorder assembly (CLR2, ditto); that constant is only set when Platform is AnyCPU. Fixing is trivial -- just hoist the constant out of the conditional PropertyGroup elements in the .fsproj file -- but is insufficient of itself.
  • the 64-bit dotnet command will happily build x86 assemblies if directed through the environment variable "Platform" (though no documented command-line flag does this), but doesn't want to execute them, dotnet run protesting with System.BadImageFormatException when you try. This seems to be the next issue that's been hit.

If the full framework is available, it would be worth trying the experiment of using the net45 version instead -- that is one of the test cases in the build, and it also with mono on Linux -- where at least you have known AnyCPU assemblies.

Meanwhile, I have a test matrix to draw up and fill in.

from altcover.

SteveGilham avatar SteveGilham commented on August 25, 2024

So I installed the x86 build of the .net core SDK 2.1.4; and while C:\Program Files (x86)\dotnet\ has been added to my PATH, it's sandwiched in-between to instances of C:\Program Files\dotnet\. This means that what gets defaulted by invoking just dotnet is still the 64-bit version.

That means that even after I've fixed the compilation constant, running instrumentation with %Platform% as "x86" still blows up with System.BadImageFormatException. If I specifically invoke C:\Program Files (x86)\dotnet\dotnet.EXE, however, the instrumentation step works.

from altcover.

OwenMcDonnell avatar OwenMcDonnell commented on August 25, 2024

As you suggested i tried specifically invoking the x86 dotnet.exe based on stored platform variable condition in this build
(here is related batch script)

:: Instrument the test assemblies
if "%TEMP_PLATFORM%"=="x86" (
	"C:\Program Files (x86)\dotnet\dotnet.EXE" run^
 --project altcover\altcover.1.6.230\tools\netcoreapp2.0\AltCover\altcover.core.fsproj --configuration %CONFIGURATION% --^
 -i=AdvancedDLSupport.Tests\bin\%OUTPUT_DIR%\netcoreapp2.0 -o=instrumented-adl -x=coverage-adl.xml^
 --assemblyExcludeFilter=.+\.Tests --assemblyExcludeFilter=AltCover.+ --assemblyExcludeFilter=Mono\.DllMap.+

	"C:\Program Files (x86)\dotnet\dotnet.EXE" run^
 --project altcover\altcover.1.6.230\tools\netcoreapp2.0\AltCover\altcover.core.fsproj --configuration %CONFIGURATION% --^
 -i=Mono.DllMap.Tests\bin\%OUTPUT_DIR%\netcoreapp2.0 -o=instrumented-mdl -x=coverage-mdl.xml^
 --assemblyExcludeFilter=.+\.Tests --assemblyExcludeFilter=AltCover.+
) else (
	"C:\Program Files\dotnet\dotnet.EXE" run^
 --project altcover\altcover.1.6.230\tools\netcoreapp2.0\AltCover\altcover.core.fsproj --configuration %CONFIGURATION% --^
 -i=AdvancedDLSupport.Tests\bin\%OUTPUT_DIR%\netcoreapp2.0 -o=instrumented-adl -x=coverage-adl.xml^
 --assemblyExcludeFilter=.+\.Tests --assemblyExcludeFilter=AltCover.+ --assemblyExcludeFilter=Mono\.DllMap.+

	"C:\Program Files\dotnet\dotnet.EXE" run^
 --project altcover\altcover.1.6.230\tools\netcoreapp2.0\AltCover\altcover.core.fsproj --configuration %CONFIGURATION% --^
 -i=Mono.DllMap.Tests\bin\%OUTPUT_DIR%\netcoreapp2.0 -o=instrumented-mdl -x=coverage-mdl.xml^
 --assemblyExcludeFilter=.+\.Tests --assemblyExcludeFilter=AltCover.+

)

but got a Did you mean to run dotnet SDK commands? message.
Any insight into why that might be happening?

from altcover.

OwenMcDonnell avatar OwenMcDonnell commented on August 25, 2024

Sorry, you can disregard the last question. I wrongly assumed the build machine had the x86 dotnet sdk installed.

from altcover.

SteveGilham avatar SteveGilham commented on August 25, 2024

Assuming the thumbs-up and a quiet week means all is now good.

from altcover.

OwenMcDonnell avatar OwenMcDonnell commented on August 25, 2024

I believe so.

from altcover.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.