No result with opencover + xunit - xunit

I was trying to use OpenCover (downloaded today) to get coverage of my tests. Here is the command line I've used :
OpenCover.Console.exe -target:"c:\Programmes2\xunit\xunit.console.clr4.x86.exe" -targetargs:"""C:\Sources\Project\BackOffice.Tests\bin\Debug\BackOffice.Tests.dll"" /noshadow " -output:bo.coverage.xml -targetdir:"C:\Sources\Project\BackOffice.Tests\bin\Debug" -filter:+[*]*
And here is the output I get
xUnit.net console test runner (32-bit .NET 4.0.30319.269)
Copyright (C) 2007-11 Microsoft Corporation.
xunit.dll: Version 1.9.0.1566
Test assembly: C:\Sources\Project\BackOffice.Tests\bin\Debug\BackOffice.Tests.dll
31 total, 0 failed, 0 skipped, took 2.760 seconds
Committing...
No results - no assemblies that matched the supplied filter were instrumented
this could be due to missing PDBs for the assemblies that match the filter
please review the output file and refer to the Usage guide (Usage.rtf)
The generated report is always the same:
<?xml version="1.0" encoding="utf-8"?>
<CoverageSession xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Modules />
</CoverageSession>
A bit more context : The PDB's are present in the target folder, I'm running the Command prompt as an administrator. The project tested is an .net 4/mvc 3 application. My computer is running windows 7/32bits. On that topic, not sure if that's relevant in any way, but the x86 folder in the is empty, even if I force the target plateform to be x86.
Also, when I try to register the OpenCover.Profiler.dll with regsvr32, I get an error that says that the dll may not be compatible with my windows version.
If I try to user the -register or the -register:user parameters, I get an exception:
An exception occured: Failed to register(user:True,register:True,is64:False):3 the profiler assembly; you may want to look into permissions or using the -register:user option instead. C:\Windows\system32\regsvr32.exe /s /n /i:user "C:\Sources\Opencover\sawilde-opencover-be6e491\main\bin\Debug\x86\OpenCover.Profiler.dll"
stack:
à OpenCover.Framework.ProfilerRegistration.ExecuteRegsvr32(Boolean userRegistration, Boolean register, Boolean is64) dans C:\Sources\Opencover\sawilde-opencover-be6e491\main\OpenCover.Framework\ProfilerRegistration.cs:ligne 59
à OpenCover.Framework.ProfilerRegistration.ExecuteRegsvr32(Boolean userRegistration, Boolean register) dans C:\Sources\Opencover\sawilde-opencover-be6e491\main\OpenCover.Framework\ProfilerRegistration.cs:ligne 45
à OpenCover.Framework.ProfilerRegistration.Register(Boolean userRegistration) dans C:\Sources\Opencover\sawilde-opencover-be6e491\main\OpenCover.Framework\ProfilerRegistration.cs:ligne 31
à OpenCover.Console.Program.Main(String[] args) dans C:\Sources\Opencover\sawilde-opencover-be6e491\main\OpenCover.Console\Program.cs:ligne 82
I also tried with a DLL project (.net4) tested by a different project (xunit also), with the same (lack of) result.
Any help appreciated !

Downloading the release package solved the exception from the register parameter. But running the same command line generated multiple errors of this kind:
BackOffice.Tests.HomeControllerShould.Redirect_To_Action_Feed_Index [FAIL]
System.MissingMethodException : Méthode introuvable : 'Void System.CannotUnloadAppDomainException.SafeVisited(Int32)'.
Stack Trace:
à BackOffice.Tests.HomeControllerShould..ctor()
with this result:
31 total, 31 failed, 0 skipped, took 0.241 seconds
Committing...
Visited Classes 0 of 44 (0)
Visited Methods 0 of 183 (0)
Visited Points 0 of 1352 (0)
Visited Branches 0 of 322 (0)
==== Alternative Results (includes all methods including those without corresponding source) ====
Alternative Visited Classes 0 of 53 (0)
Alternative Visited Methods 0 of 268 (0)
After looking around for similar issues, I found this issue on github and tried the -oldStyle parameter. It solved mine.
#Shaun Wilde, if by any chance you see this question again, could you tell us if it's the recommended way to solve it and if we lose something from using it against the "normal" way (I would also suggest adding this parameter to the documentation page

Related

NuGet MSTest.TestAdapter.3.0.0 crashes in .Net "Framework" 4.8

Edited: as #Diego Malanij pointed out in answer
https://stackoverflow.com/a/74768591/4489263 it's the MSTest.TestAdapter 3.0.0 package causing the following observed misbehavior, whereas MSTest.TestFramework 3.0.0 works well
After updating NuGet packages in a .Net 4.8 solution, MS UnitTests just reproducibly stopped working here in Visual Studio 2022 "Community Edition" on Windows 10 without having changed anything in the custom solution itself.
The same update(s) work well in a .Net6.0 solution
UnitTests
Updates:
MSTest.TestFramework.2.2.10 -> MSTest.TestFramework.3.0.0
MSTest.TestAdapter.2.2.10 -> MSTest.TestAdapter.3.0.0
The Output window in the .Net4.8 solution shows exceptions, and the Test Explorer says:
UnitTests
Tests in group: 134
Outcomes
 134 Not Run
Output Window :
========== Test run finished: 0 Tests (0 Passed, 0 Failed, 0 Skipped) run in 127 ms ==========
Log level is set to Informational (Default).
Source code repository not available. Some features may not work as expected.
Connected to test environment '< Local Windows Environment >'
Test data store opened in 0,139 sec.
========== Starting test discovery ==========
No test is available in D:\Dev.Net\ProdSW\RingManager\RingManager\RingManager.Data\bin\Debug\RingManager.Data.dll. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.
No test is available in D:\Dev.Net\ProdSW\RingManager\RingManager\RingManager\bin\Debug\RingManager.exe. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.
No test is available in D:\Dev.Net\ProdSW\RingManager\RingManager\RingManager.CommonViews\bin\Debug\RingManager.CommonViews.dll. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.
No test is available in D:\Dev.Net\ProdSW\RingManager\RingManager\RingManager.Common\bin\Debug\RingManager.Common.dll. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.
========== Test discovery finished: 134 Tests found in 3 sec ==========
========== Starting test run ==========
========== Test run finished: 134 Tests (134 Passed, 0 Failed, 0 Skipped) run in 16,7 sec ==========
Starting test discovery for requested test run
========== Starting test discovery ==========
========== Test discovery finished: 134 Tests found in 1,7 sec ==========
========== Starting test run ==========
An exception occurred while invoking executor 'executor://mstestadapter/v2': Could not load file or assembly 'Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
Stack trace:
at Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.TestDeployment.GetDeploymentInformation(String source)
at Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestExecutionManager.ExecuteTestsInSource(IEnumerable1 tests, IRunContext runContext, IFrameworkHandle frameworkHandle, String source, Boolean isDeploymentDone) at Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestExecutionManager.ExecuteTests(IEnumerable1 tests, IRunContext runContext, IFrameworkHandle frameworkHandle, Boolean isDeploymentDone)
at Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.Execution.TestExecutionManager.RunTests(IEnumerable1 tests, IRunContext runContext, IFrameworkHandle frameworkHandle, TestRunCancellationToken runCancellationToken) at Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.MSTestExecutor.RunTests(IEnumerable1 tests, IRunContext runContext, IFrameworkHandle frameworkHandle)
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Execution.RunTestsWithTests.InvokeExecutor(LazyExtension2 executor, Tuple2 executorUri, RunContext runContext, IFrameworkHandle frameworkHandle)
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Execution.BaseRunTests.<>c__DisplayClass46_0.b__0()
at Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformThread.<>c__DisplayClass0_0.b__0()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.PlatformThread.Run(Action action, PlatformApartmentState apartmentState, Boolean waitForCompletion)
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Execution.BaseRunTests.TryToRunInStaThread(Action action, Boolean waitForCompletion)
at Microsoft.VisualStudio.TestPlatform.CrossPlatEngine.Execution.BaseRunTests.RunTestInternalWithExecutors(IEnumerable`1 executorUriExtensionMap, Int64 totalTests)
========== Test run finished: 0 Tests (0 Passed, 0 Failed, 0 Skipped) run in 127 ms ==========
After reverting the changes via version control system - and restarting VS - all is back to normal.
So I guess I'll wait a little and then might try again with a next NuGet version, and this is more a warning than a question asking for help
I've found the same issue with my solution. Today I was able to dig a bit deeper with fusion log and the problem is that the assembly is being searched in the appbase for the testhost, rather than the location of the unit test output itself (meaning bin\debug or bin\release).
I've taken a look at the MSTest.TestAdapter package itself and its props... it has changed the structure regarding the previous version, and now it contains the Microsoft.VisualStudio.TestPlatform.TestFramework assembly (which is loaded from the packages\MSTest.TestAdapter.3.0.0\build\net462 location), but the extensions are no there.
I tried copying the missing dll in that location and tests execution succeeded, however that's clearly not a solution.
In my case this is with Visual Studio 2019, and I thought 2022 might have this solved but clearly after finding your post, that's not the case; I'll try to go a bit further with the analysis later, but as for now the only option is not updating the MSTest.TestAdapter package (the MSTest.TestFramwork is fine at 3.0.0).
MSTest.TestAdapter.3.0.1 now being available apparently cures the symptom, may have been a temporary bug in its version 3.0.0.
After installing NuGet
Updates:
MSTest.TestFramework.3.0.0 -> MSTest.TestFramework.3.0.1
MSTest.TestAdapter.2.2.10 -> MSTest.TestAdapter.3.0.1
... all seems to be okay again

Sometimes when I run `npx hardhat compile` I get this error: FATAL ERROR: NewNativeModule Allocation failed - process out of memor

Sometimes when I run this command npx hardhat compile on my windows cli I get the error below:
Compiling 72 files with 0.7.0
contracts/libraries/ERC20.sol: Warning: SPDX license identifier not provided in source file. Before publishing, consider adding a comment containing "SPDX-License-Identifier: <SPDX-License>" to each source file. Use "SPDX-License-Identifier: UNLICENSED" for non-open-source code.
Please see https://spdx.org for more information.
contracts/libraries/ERC1155/EnumerableSet.sol:158:5: Warning: Variable is shadowed in inline assembly by an instruction of the same name
function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
^ (Relevant source part starts here and spans across multiple lines).
contracts/libraries/ERC1155/EnumerableSet.sol:224:5: Warning: Variable is shadowed in inline assembly by an instruction of the same name
function add(AddressSet storage set, address value) internal returns (bool) {
^ (Relevant source part starts here and spans across multiple lines).
Compiling 1 file with 0.8.0
<--- Last few GCs --->
[8432:042B0460] 263058 ms: Mark-sweep (reduce) 349.8 (356.3) -> 248.2 (262.4) MB, 434.4 / 0.2 ms (+ 70.9 ms in 3 steps since start of marking, biggest step 69.6 ms, walltime since start of marking 800 ms) (average mu = 0.989, current mu = 0.990) memory[8432:042B0460] 263627
ms: Mark-sweep (reduce) 248.2 (259.4) -> 248.2 (252.1) MB, 555.5 / 0.0 ms (+ 0.0 ms in 0 steps since start of marking, biggest step 0.0 ms, walltime since start of marking 556 ms) (average mu = 0.969, current
mu = 0.023) memory p
<--- JS stacktrace --->
FATAL ERROR: NewNativeModule Allocation failed - process out of memory`
After some time the error just kind of goes away.
It goes away probably after I've restarted my system or created a new Hardhat project and imported the code there.
But this is happening too often, what could be the cause?
I've done quite some research and some answers suggested it might be a problem with Node and the application's memory allocation, but I don't know how I would apply the solutions to a Hardhat project.
Here is a link to one possible solution: https://medium.com/#vuongtran/how-to-solve-process-out-of-memory-in-node-js-5f0de8f8464c
OS: WINDOWS 10
CLI: WINDOWS CMD

Visual studio installer doesn't start correctly

I just had to change my HDD. So I installed a version of Windows 10 Education on my computer, and now I'm trying to install Visual studio 2017 community/enterprise ( tried both ). After running the installer which was downloaded from the official website it doesn't start the installation, I just see for a tiny amount of time a small window pop but then it instantly shuts. What could be the reason for this behavior and how to fix this problem?
Edit: I can install other software, I managed to install a few other programs without a problem, I notice this behavior only with Visual studio and additionally .NET Framework installer.
Edit2:
I found this in my temp folder :
[4/20/2017, 11:30:37] === Logging started: 2017/04/20 11:30:37 ===
[4/20/2017, 11:30:37] [4/20/2017, 11:30:38] --- logging level: standard ---
[4/20/2017, 11:30:38] Directory 'C:\Users\2D94~1\AppData\Local\Temp\931f7233a5c56697278d79b1\' has been selected for file extraction
[4/20/2017, 11:30:38] Extracting files to: C:\Users\2D94~1\AppData\Local\Temp\931f7233a5c56697278d79b1\
[4/20/2017, 11:30:38] Error 0x8007002a: Failed to extract all files out of box container #0.
[4/20/2017, 11:30:38] Error 0x8007002a: Failed to extract
[4/20/2017, 11:30:38] Error 0x8007013d: Failed to get error string from error: 0x8007002a
[4/20/2017, 11:30:38] The entire Box execution exiting with result code: 0x8007002a
[4/20/2017, 11:30:38] Launched extracted application exiting with result code: 0x0
[4/20/2017, 11:30:38] === Logging stopped: 2017/04/20 11:30:38 ===
Edit 3: THANKS MICROSOFT you really screwed me up huh.
Edit 4: After full Windows reinstall with the latest version still getting this error.
Edit 5: Changed windows version from education to professional and it works!
Had the same issue. I was running installer from my /Download folder.
Try move the installer to D: drive, it helped me.
Regards

Chilkat ftp.SyncLocalDir with open files?

I’m having an issue with ftp.SyncLocalDir when I have an open file on the local directory.
I’m using the example from http://www.example-code.com/vbnet/ftp_syncLocalTree.asp with a few minor changes. It has been working fine for a few days and then has stopped working.
I’ve found that one of the files is open on the local directory. Looking through the http://chilkatforum.com/ forum I see that one of the answers stated that
“Chilkat will detect errors that are likely permission/access errors and will continue with the remainder of the download.”
This is not happening for me. Looking at the last error text it states that the file is used by another process. Not other files get synchronized.
Is the something else I need to add to the code to force it to continue after the error?
Below is the last error text.
Thanks,
Steve
ChilkatLog:
SyncLocalDir:
DllDate: Dec 5 2014
ChilkatVersion: 9.5.0.46
UnlockPrefix: *********
Username: *********
Architecture: Little Endian; 32-bit
Language: .NET 4.0
VerboseLogging: 0
commandCharset: ansi
dirListingCharset: ansi
localDirPath: Q:\TEST
mode: 2
ProgressMonitoring:
enabled: yes
heartbeatMs: 0
sendBufferSize: 65536
--ProgressMonitoring
downloadDir:
getFile2:
localFilename: Q:\TEST/LINE_6 _13.csv
Replacing existing local file
openForReadWriteWin32:
Failed to open file (2)
localFilePath: Q:\TEST\LINE_6 _13.csv
currentWorkingDirectory: H:\Code In Progress\LLS\Gen 3 Test And Crimp
w-network\VB Code\trunk\FTP Syncronize\bin\Debug
osErrorInfo: The process cannot access the file because it is being us
ed by another process.
localWindowsFilePath: Q:\TEST\Line 6\LINE_6 _13.csv
--openForReadWriteWin32
--getFile2
Failed to download file
failedFilename: /LINE_6 _13.csv
--downloadDir
Failed.
--SyncLocalDir
--ChilkatLog
Please try this new build for the .NET 4.0 Framework:
32-bit Download: http://www.chilkatsoft.com/download/preRelease/ChilkatDotNet4-9.5.0-win32.zip
64-bit Download: http://www.chilkatsoft.com/download/preRelease/ChilkatDotNet4-9.5.0-x64.zip
The feature for continuing past permission/access issues had to do with issues on the remote server as opposed to the local filesystem. This new build should now also do the same for local permission errors. It will be noted in the release notes for Chilkat version 9.5.0.47 when released (soon).
If you have trouble, please post the LastErrorText using this new build.

fsyacc errors when building in Visual Studio

I'm using fsyacc within Visual Studio (using the Parsed Language Starter template), but the build output doesn't show the line/column where the error occured (only: fsyacc exited with code 1). I have to build from the command prompt to get this information, somewhat negating the benefit of VS integration.
Is there a way to show this in the output window?
EDIT
Here are some examples of errors that aren't shown in the output window.
Parser.fsy(74,4): error: parse error
and
building tables
FSYACC: error FSY000: NonTerminal 'query' has no productions
Here's success output that would be nice to see also:
building tables
computing first function...time: 00:00:00.1318603
building kernels...time: 00:00:00.1027372
building kernel table...time: 00:00:00.0533044
computing lookahead relations.............................
..............time: 00:00:00.0517415
building lookahead table...time: 00:00:00.0207993
building action table...state 29: shift/reduce error on AS
state 49: shift/reduce error on OR
state 49: shift/reduce error on AND
...
time: 00:00:00.1457792
building goto table...time: 00:00:00.0035636
returning tables.
39 shift/reduce conflicts
62 states
11 nonterminals
41 terminals
46 productions
#rows in action table: 62
Instead of using Parsed Language Starter template, I build parser/lexer by using Pre-build event in Build Events from VS Project Properties:
fslex "$(ProjectDir)Lexer.fsl"
fsyacc --module Grammar "$(ProjectDir)Grammar.fsy"
It is not very desirable since I have to set fsyacc/fslex in Path environment variable. Whenever I don't want to rebuild parser/lexer, I have to comment out the following part in fsproj file:
<PropertyGroup>
<PreBuildEvent>fslex "$(ProjectDir)Lexer.fsl"
fsyacc --module Grammar "$(ProjectDir)Grammar.fsy"
</PreBuildEvent>
</PropertyGroup>
However, the winning point is clear. We have all messages including errors and success output in stdout which is convenient for debugging.

Resources