Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

2 Pages12>
Even the simplest .NET Core project fails to build under NCrunch
Tim Long
#1 Posted : Wednesday, July 26, 2017 3:41:29 PM(UTC)
Rank: Member

Groups: Registered
Joined: 8/20/2016(UTC)
Posts: 13
Location: United Kingdom

Was thanked: 1 time(s) in 1 post(s)
Hi there. Noting that .NET Core support has arrived, I am filled with enthusiasm because I now have a way to test some of my UWP code. What I intend to do is put all my ViewModel code into a .NET Standard library, then include that into a .NET Core test project (class library). VS 2017 creates a class library that targets .NET Core 1.1 so I've gone with the defaults.

However, I've fallen at the first fence. I can't get NCrunch to successfully build even the simplest of .NET Core projects (it builds fine in Visual Studio 2017 and I'm using Preview - 15.3.0 Preview 4.0). Note that I have to use this version because I need support for UWP on Windows 10 IoT Creator's Update, build 15063 and that requires VS 2017 preview.

So I'm trying to run this simple test project as "Debug | Any CPU" which is the default configuration created by Visual Studio. It's defaults all the way. Here's the code:

Code:
using Xunit;

namespace TA.UWP.Tests
{
    class NCrunchIceBreakerTests
    {
        [Fact]
        void TheFundamentalTruthsStillApply()
        {
            Assert.True(true); // True is still true
        }
    }
}


Simple, right? Obviously I'm referencing xUnit (2.2.0) via NuGet. This builds in VS (can't run it because it's a class library). However in NCrunch I get a variety of unconvincing results.

Right now, I'm getting the red "pending" icon and in the status it says "Failed last build, rebuilding". But it isn't rebuilding and it never does.

Either I'm missing something really obvious (very possible) or something is broken... any suggestions please? I so want this to work because more than half my code is targetting UWP and/or .NET Core and I don't currently have a convincing test strategy for it.


Tim Long
#2 Posted : Wednesday, July 26, 2017 3:57:50 PM(UTC)
Rank: Member

Groups: Registered
Joined: 8/20/2016(UTC)
Posts: 13
Location: United Kingdom

Was thanked: 1 time(s) in 1 post(s)
All right, it looks like I'm not understanding how test runners work in .NET Core. I tried re-creating my project as a "Unit test application" and now it is building and running the tests in NCrunch. I thought that NCrunch would be able to run tests from a class library, like it does for .NET Framework projects. All these frameworks, platforms and standards are confusing, to say the very least!

The errors in NCrunch are a bit confusing as well though, since it looks like the project cannot build. It seems like it's not actually a "build" problem because the project builds fine in VS. So it would be better if NCrunch gave a more meaningful error, like "Can't run tests from a class library".

Regards,
Tim
Remco
#3 Posted : Wednesday, July 26, 2017 11:11:49 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 4,872

Thanks: 649 times
Was thanked: 756 time(s) in 721 post(s)
Hi Tim,

Thanks for sharing this problem. It shouldn't be required to create a unit test library using a VS template to run NCrunch on a .NET Core project, simply referencing a test framework package should be enough. I'm not sure what went wrong here, but I do have a theory. The synchronisation between VS and NCrunch around project creation and setup under .NET Core isn't yet bullet proof. It's likely that NCrunch managed to get out of sync with the changes happening in VS while the project was created, and managed to get an incomplete snapshot of the project. If this happens, just resetting the engine should usually solve the problem. If you still have any persistent error messages, please do share these and I'll try to investigate and advise.
GibSral
#4 Posted : Tuesday, August 01, 2017 1:17:32 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 12/1/2014(UTC)
Posts: 6
Location: Germany

Thanks: 2 times
I have a similar issue.
When building a .net core project ncrunch fails with the following log entry (I replaced my local user with $USER$ in the paths):

ENGINE - [14:50:24.962-Core-27] Event [ErrorEvent:[Error:
Context: (global)
Category: Internal
Message: Unable to find version 1.1.0 of .NET Core. Please make sure your project is targeting a version of .NET Core that is installed in your Nuget packages directory at C:\Users\$USER$\.nuget\packages
Details: System.Exception: Unable to find version 1.1.0 of .NET Core. Please make sure your project is targeting a version of .NET Core that is installed in your Nuget packages directory at C:\Users\$USER$\.nuget\packages
bei nCrunch.Core.PlatformTypes.DotNetCoreBuildExtender.(FilePath )
bei nCrunch.Core.PlatformTypes.DotNetCoreBuildExtender.(SnapshotComponent , BuildOutput )
bei nCrunch.Core.PlatformTypes.DotNetCoreBuildExtender.ProcessSuccessfulBuildOutput(SnapshotComponent component, BuildOutput buildOutput, IList`1 componentReferences)
bei nCrunch.Core.BuildManagement.BuildEnvironment.Build(SnapshotComponent snapshotComponentToBuild, IList`1 referencedComponents, GridClientId gridClientId, IList`1 customEnvironmentVariables, IPlatformBuildExtender extender)
bei nCrunch.Core.Processing.BuildTaskLogic.DoProcessTaskAndReturnSuccessFlag()
bei nCrunch.Core.Processing.TaskLogic.ProcessTaskAndReturnSuccessFlag()
bei nCrunch.Client.Processing.LocalProcessingTask.ProcessTaskAndReturnSuccessFlag()
bei nCrunch.Client.Processing.ProcessingQueue..()
]] is being processed on Core thread with subscriber: ErrorHandler.


This also happens when creating a fresh project.
ncrunch searches for the 1.1.0 version of .net core but version 1.1.2 is installed and used in the project.

This only happens in Version 3.10.0.20.
After downgrading to Version 3.9.0.1 ncrunch builds .net core projects without errors

Greetings
Lars
Remco
#5 Posted : Wednesday, August 02, 2017 12:25:02 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 4,872

Thanks: 649 times
Was thanked: 756 time(s) in 721 post(s)
Hi Lars,

Thanks for sharing this problem.

.NET Core seems to have some kind of indirection between the requested version of .NET Core and the version eventually resolved by the runtime. The logic underneath here doesn't have a strong pattern of consistency that I've recognised and it seems to change with almost every minor VS update. The exception NCrunch is throwing is because the TargetFramework specified in your project is likely to be netcoreapp1.1, but .NET Core 1.1.0 isn't available under your Nuget packages.

The easiest way to get this to work is to make sure you have Microsoft.NetCore.App/1.1.0 Nuget package installed. This will get NCrunch past the check that throws the exception, then the .NET Core runtime magic will hopefully resolve to the right version when it constructs a test environment.
Der-Albert.com
#6 Posted : Monday, August 07, 2017 5:37:19 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 5/17/2011(UTC)
Posts: 94

Was thanked: 16 time(s) in 14 post(s)
Hi,

i had just a similar problem.

I installed the NCrunch Grid Node Server on a seperate Machine (to offload the work).

Installed was i need, VS 2017.3 Preview 7, .NET Core SDK 1.0.4, .NET Core 2 Preview 2 etc.

Made lokal Build of a an dotnet new mvc App, for 1.1 and 2.0.

Then switch on distributed Processing. Error Occurs, Unabled to find Version 1.1 of .NET Core.

I had to switch to NCrunch Grid Node Service from SYSTEM logon, to the local user account. Then everything works.

I assume the Problem ist the Bug, that if .NET Core2 Preview 2 is installed,
the intial run of dotnet restore (or something like this) for a 1.1 project on a new account (SYSTEM in that case) fails. You have two uninstall .NET Core 2, then make dotnet restore for the 1.1 project, install .NET Core 2 again.

I've done this in the right order for the local account, but it is not possible to do for SYSTEM. But, would explain this behaviour and fx in my case.

Best Regards

Albert



1 user thanked Der-Albert.com for this useful post.
Remco on 8/7/2017(UTC)
GreenMoose
#7 Posted : Tuesday, August 22, 2017 2:29:03 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 6/17/2012(UTC)
Posts: 312

Thanks: 48 times
Was thanked: 33 time(s) in 32 post(s)
I have the same issue on a build server (dotnet restore/build works fine) with NCrunch console tool, not having visual studio installed.
How can I ensure "make sure you have Microsoft.NetCore.App/1.1.0 Nuget package installed." ?

Some details:
Using Ncrunch v3.9.0.1 I get error
Quote:

14:20:18.6666-LocalBuildTask-18] Now building Labs.Misc.Test.Misc
14:20:19.4076-LocalBuildTask-18] Build was successful for C:\Users\Stefan\AppData\Local\NCrunch\8384\2\test\Labs.Misc.Test.Misc\bin\Debug\
Misc.dll
14:20:19.9912-LocalAnalysisTask-5] ERROR (Internal): nCrunch.TaskRunner.Ipc.IpcConnectionClosedException: The connection has been closed
at nCrunch.TaskRunner.Ipc.Fast.IpcReader.Initialise()
at nCrunch.TaskRunner.Ipc.Fast.IpcStream.Connect(String ipcName, Boolean isHost)

And if I use NCrunch v3.10.0.20 I get error
Quote:

...
[14:21:55.3473-LocalBuildTask-11] Now building Labs.Misc.StdLib1
[14:21:56.5912-LocalBuildTask-11] Build was successful for C:\Users\...
...
14:21:56.6861-LocalBuildTask-13] Now building Labs.Misc.Test.Misc
14:21:57.3628-LocalBuildTask-13] ERROR (Internal): System.Exception: Unable to find version 1.1.0 of .NET Core. Please make sure your project is targeting a version of .NET Core that is installed in your Nuget packages directory at C:\Users\Stefan\.nuget\packages
at nCrunch.Core.PlatformTypes.DotNetCoreBuildExtender.(FilePath )


This machine does not have vs installed (only vs2017 build tools -> dotnetcore).


The 2 project files runs fine on my dev machine having vs2017 installed, and dotnet build with the solution works fine.

Project file contents:
Quote:

PS C:\TeamCity\buildAgent\work\969002e4bbebde55\Labs.Misc> type .\src\Labs.Misc.StdLib1\Labs.Misc.StdLib1.csproj :
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard1.4</TargetFramework>
</PropertyGroup>

</Project>
PS C:\TeamCity\buildAgent\work\969002e4bbebde55\Labs.Misc> type .\test\Labs.Misc.Test.Misc\Labs.Misc.Test.Misc.csproj
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="NUnit" Version="3.7.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Labs.Misc.StdLib1\Labs.Misc.StdLib1.csproj" />
</ItemGroup>

</Project>


Thanks.
GreenMoose
#8 Posted : Tuesday, August 22, 2017 3:59:23 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 6/17/2012(UTC)
Posts: 312

Thanks: 48 times
Was thanked: 33 time(s) in 32 post(s)
Regarding my error above, I got the dotnetcore installed by referencing Microsoft.NETCore.App in the test project's csproj (nuget install-package), and then using nuget restore to get it in my C:\Users\...\.nuget\packages\microsoft.netcore.app:
Quote:

<PackageReference Update="Microsoft.NETCore.App" Version="1.1.0" />



Although now NCrunch results in a different error:
Quote:

[15:52:46.7877-LocalAnalysisTask-4] ERROR (Internal): nCrunch.TaskRunner.Ipc.IpcConnectionClosedException: The connection has been closed
at nCrunch.TaskRunner.Ipc.Fast.IpcReader.Initialise()
at nCrunch.TaskRunner.Ipc.Fast.IpcStream.Connect(String ipcName, Boolean isHost)
at nCrunch.TaskRunner.Ipc.Fast.FastIpcClient.Connect(String ipcName)
at nCrunch.Core.ProcessManagement.DefaultProcessLoader.ConnectToProcess(ExternalProcess externalProcess, ProcessLoadParameters parameters, Action`1 outOfBandMessageHandler)
at nCrunch.Core.ProcessManagement.ExternalProcessManager..()
at nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
at nCrunch.Common.PerformanceTracking.PerfTracker.TryTrackActivity(String name, Action activity)
at nCrunch.Core.ProcessManagement.ExternalProcessManager.(ProcessorArchitecture , ProcessLoadParameters )



I also get this same error when trying out a simple test project with dotnet core 2.0 created via "dotnet new classlib -n testLib -f netcoreapp2.0", and then referencing NUnit 3.7.1 with a simple test fixture. :/
Remco
#9 Posted : Tuesday, August 22, 2017 10:33:44 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 4,872

Thanks: 649 times
Was thanked: 756 time(s) in 721 post(s)
GreenMoose
#10 Posted : Wednesday, August 23, 2017 6:28:46 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 6/17/2012(UTC)
Posts: 312

Thanks: 48 times
Was thanked: 33 time(s) in 32 post(s)
(using v3.11.0.5)
Remco;11025 wrote:
Would you be able to submit a bug report after you've had the connection closed exception? Likely this is caused by a missing dependency. The log should reveal which one.


This is on a build system not having visual studio installed (only vs 2017 build tools for dotnetcore).
Interestingly enough, when I install a grid node on the same server, and use that grid node to execute the test from my dev machine, everything works out fine.

Can I somehow generate a log with the console tool?
Remco
#11 Posted : Wednesday, August 23, 2017 8:00:59 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 4,872

Thanks: 649 times
Was thanked: 756 time(s) in 721 post(s)
GreenMoose;11029 wrote:

Can I somehow generate a log with the console tool?


Absolutely. Just set "-LogVerbosity Detailed" on the command line, and use the standard pipe to push the output to file, i.e.

ncrunch.exe mysolution.sln -LogVerbosity Detailed > mylog.txt

The log should contain some extra error information somewhere near the exception that was thrown.
GreenMoose
#12 Posted : Wednesday, August 23, 2017 11:52:44 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 6/17/2012(UTC)
Posts: 312

Thanks: 48 times
Was thanked: 33 time(s) in 32 post(s)
Is below sufficient or should I submit the entire log? Is it the process 3920 that dies for some reason?
Quote:

[11:46:11.348-LocalAnalysisTask-20] Adding external process with Id '7cb121fed81045e88f636985959056c4'
[11:46:11.348-LocalAnalysisTask-20] Starting external process '"C:\Program Files\dotnet\dotnet.exe"' with arguments '"C:\Users\Stefan\AppData\Local\NCrunch\4220\2\test\Labs.Misc.DotnetTest2\bin\Debug\netcoreapp1.1\nCrunch.TaskRunner.DotNetCore.10.x64.dll" 4220 nCrunch_991b3fadf02f4d54a58aa95dde149344 7cb121fed81045e88f636985959056c4 "C:\Program Files (x86)\Remco Software\NCrunch Console Tool\nCrunch.TestExecution.DotNetCore.dll" nCrunch.TestExecution.RemoteTaskRunner "C:\Users\Stefan\AppData\Local\NCrunch\4220\2\test\Labs.Misc.DotnetTest2\bin\Debug\netcoreapp1.1" "False" "C:\Users\Stefan\AppData\Local\NCrunch\4220\2\test\Labs.Misc.DotnetTest2\bin\Debug\netcoreapp1.1\Labs.Misc.DotnetTest2.dll.config.ncrunchconfig"'
[11:46:11.35-LocalAnalysisTask-20] Process ID '3920' initialised
[11:46:11.35-LocalAnalysisTask-20] Connecting to external process '7cb121fed81045e88f636985959056c4' with id 3920
[11:46:11.3968-?-10] Process with id 3920 has exited
[11:46:11.3968-?-10] Removing external process with Id '7cb121fed81045e88f636985959056c4'
[11:46:11.3978-LocalAnalysisTask-20] Removing external process with Id '7cb121fed81045e88f636985959056c4'
[11:46:11.4009-LocalAnalysisTask-20] ERROR (Internal): nCrunch.TaskRunner.Ipc.IpcConnectionClosedException: The connection has been closed
at nCrunch.TaskRunner.Ipc.Fast.IpcReader.Initialise()
at nCrunch.TaskRunner.Ipc.Fast.IpcStream.Connect(String ipcName, Boolean isHost)
at nCrunch.TaskRunner.Ipc.Fast.FastIpcClient.Connect(String ipcName)
at nCrunch.Core.ProcessManagement.DefaultProcessLoader.ConnectToProcess(ExternalProcess externalProcess, ProcessLoadParameters parameters, Action`1 outOfBandMessageHandler)
at nCrunch.Core.ProcessManagement.ExternalProcessManager..()
at nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
at nCrunch.Common.PerformanceTracking.PerfTracker.TryTrackActivity(String name, Action activity)
at nCrunch.Core.ProcessManagement.ExternalProcessManager.(ProcessorArchitecture , ProcessLoadParameters )

[11:46:11.4029-LocalAnalysisTask-20] Task processing complete for [LocalAnalysisTask: [SnapshotComponent: Labs.Misc.DotnetTest2, 1, 39055277], BeingProcessed, (local), 0cfcc4b7-0c23-4e95-929a-80fdf35a4030], processing time: 00:00:00
[11:46:11.4029-LocalAnalysisTask-20] Publishing Event: [ :[LocalAnalysisTask: [SnapshotComponent: Labs.Misc.DotnetTest2, 1, 39055277], BeingProcessed, (local), 0cfcc4b7-0c23-4e95-929a-80fdf35a4030]]
[11:46:11.4029-LocalAnalysisTask-20] Event [ :[LocalAnalysisTask: [SnapshotComponent: Labs.Misc.DotnetTest2, 1, 39055277], BeingProcessed, (local), 0cfcc4b7-0c23-4e95-929a-80fdf35a4030]] is being published on thread CoreThread to subscriber: ProcessingQueue.
[11:46:11.4039-Core-15] Event [ :[LocalAnalysisTask: [SnapshotComponent: Labs.Misc.DotnetTest2, 1, 39055277], BeingProcessed, (local), 0cfcc4b7-0c23-4e95-929a-80fdf35a4030]] is being processed on Core thread with subscriber: ProcessingQueue.
[11:46:11.4059-Core-15] Unregistered usage of workspace: C:\Users\Stefan\AppData\Local\NCrunch\4220\2 (now 1 usages)




**Edit**So I went upgrading local vs2017 instance and installed dotnetcore 2 SDK locally as well, now the grid node no longer suceeds for the dotnetcore2 project (which it did for dotnetcore 1.1) with error:
Quote:

[12:53:53.8194-NodeProcessor-51] ERROR (Internal): Process e5219e79c3a9407387c100022b3c132e encountered unexpected errors in its environment:
System.IO.FileLoadException: Could not load file or assembly 'System.Runtime.Loader, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'System.Runtime.Loader, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
at Program.innerMain(String[] args)
at Program.Main(String[] args)


[12:53:53.8204-NodeProcessor-51] ERROR (Internal): nCrunch.TaskRunner.Ipc.IpcConnectionClosedException: The connection has been closed
at nCrunch.TaskRunner.Ipc.Fast.IpcReader.Initialise()
at nCrunch.TaskRunner.Ipc.Fast.IpcStream.Connect(String ipcName, Boolean isHost)
at nCrunch.TaskRunner.Ipc.Fast.FastIpcClient.Connect(String ipcName)
at nCrunch.Core.ProcessManagement.DefaultProcessLoader.ConnectToProcess(ExternalProcess externalProcess, ProcessLoadParameters parameters, Action`1 outOfBandMessageHandler)
at nCrunch.Core.ProcessManagement.ExternalProcessManager..()
at nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
at nCrunch.Common.PerformanceTracking.PerfTracker.TryTrackActivity(String name, Action activity)
at nCrunch.Core.ProcessManagement.ExternalProcessManager.(ProcessorArchitecture , ProcessLoadParameters )


**Edit2**
Now I have added process of 1) dotnet restore slnFile, 2) dotnet build slnFile, 3) nuget restore slnFile, 4) ncrunch slnFile
and now I get error below when running in the TC build agent, but works fine when running as a local user
Quote:

...
[16:03:15][Step 1/1]
[16:03:15][Step 1/1] NuGet Config files used:
[16:03:15][Step 1/1] C:\Windows\system32\config\systemprofile\AppData\Roaming\NuGet\NuGet.Config
...
[16:03:24][Step 1/1] [14:03:24.0539-LocalBuildTask-13] Now building Labs.Misc.DotnetTest2
[16:03:24][Step 1/1] [14:03:24.6769-LocalBuildTask-13] ERROR (Build): Labs.Misc.DotnetTest2: C:\TeamCity\buildAgent\temp\buildTmp\.NETCoreApp,Version=v2.0.AssemblyAttributes.cs (4): The type or namespace name 'System' could not be found in the global namespace (are you missing an assembly reference?)
[16:03:24][Step 1/1]


* Changing the TC build agent user to run with my local admin user I get the same ERROR (Internal): nCrunch.TaskRunner.Ipc.IpcConnectionClosedException again.
* If changing the NCrunch grid agent to run under my local admin user account instead of system account it also succeeds.
Remco
#13 Posted : Thursday, August 24, 2017 1:48:13 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 4,872

Thanks: 649 times
Was thanked: 756 time(s) in 721 post(s)
Ok, sorry, I'm having trouble understanding the current state here based on the changes in your environment ...

Can you confirm whether:

- You have the latest VS update, and .NET Core 2.0 SDK, installed on this system
- NCrunch.exe works when run as your local user over the solution (outside of your CI system)
- NCrunch works when run on the machine under VS
- NCrunch.GridNode.Console.exe works correctly on the machine when run under your local user account

The assembly referencing system under .NET Core has just geometrically grown in complexity. It's now at the point where I can't actually track all the places its loading assemblies from. There are now so many steps involved in swapping assemblies around and redirecting them that it's going to take me a while to untangle everything and find a consistent solution to these problems. The first thing we need to do is get your environment into a consistent state where we know what works, and what is clearly missing.
GreenMoose
#14 Posted : Thursday, August 24, 2017 8:11:08 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 6/17/2012(UTC)
Posts: 312

Thanks: 48 times
Was thanked: 33 time(s) in 32 post(s)
First of all, today the day after, it is building fine (under local user) :O. I have no idea why it does since I didn't change anything. But let's assume something was corrupt during build tools install (I got warning when first trying to upgrade build tools today, reboot was needed).

As to your questions:
I have not visual studio installed at this machine, it is a build server so I have only vstudio 2017 build tools (dotnetcore dev tools + web dev tools).
Quote:
- You have the latest VS update, and .NET Core 2.0 SDK, installed on this system

Now I use VS2017 buid tools 15.3.2 (updated from 15.3.1 2017-08-24), .net Core 2.0.0 SDK.
Quote:
NCrunch.exe works when run as your local user over the solution (outside of your CI system)

yes
Quote:
NCrunch.GridNode.Console.exe works correctly on the machine when run under your local user account

I stop grid node service and start above console (local user account). It says "listening on port..." but my vstudio cannot seem to connect to it.

Also noticed that after I have changed NCrunch Grid Node Service (non-console version) to run under Local System, I need to reboot computer in order for vstudio to be able to connect to it :/


To sum up, I only have issues when running under local system account:
1) Ncrunch Console v3.11.0.5 - when running under local system (executed from TC build agent):

Quote:

[08:42:32][Step 1/1] [06:42:32.5614-Core-4] Event [EngineModeSwitchedInUIEvent:Run all tests automatically [Global]] is being processed on Core thread with subscriber: ClientSettingsBlock.
[08:42:43][Step 1/1] [06:42:43.3766-LocalBuildTask-13] ERROR (Build): Labs.Misc.DotnetTest2: C:\TeamCity\buildAgent\temp\buildTmp\.NETCoreApp,Version=v2.0.AssemblyAttributes.cs (4): The type or namespace name 'System' could not be found in the global namespace (are you missing an assembly reference?)
[08:42:43


2) NCrunch grid node v3.11.0.5 - when running under local system:
Quote:

[08:00:00.467-NodeProcessor-16] ERROR (Internal): Process f18eb2754e674171af8465bdec25ffec encountered unexpected errors in its environment:
System.IO.FileLoadException: Could not load file or assembly 'System.Runtime.Loader, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'System.Runtime.Loader, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
at Program.innerMain(String[] args)
at Program.Main(String[] args)




[08:00:00.4846-NodeProcessor-16] ERROR (Internal): nCrunch.TaskRunner.Ipc.IpcConnectionClosedException: The connection has been closed
at nCrunch.TaskRunner.Ipc.Fast.IpcReader.Initialise()
at nCrunch.TaskRunner.Ipc.Fast.IpcStream.Connect(String ipcName, Boolean isHost)
at nCrunch.TaskRunner.Ipc.Fast.FastIpcClient.Connect(String ipcName)
at nCrunch.Core.ProcessManagement.DefaultProcessLoader.ConnectToProcess(ExternalProcess externalProcess, ProcessLoadParameters parameters, Action`1 outOfBandMessageHandler)
at nCrunch.Core.ProcessManagement.ExternalProcessManager..()
at nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
at nCrunch.Common.PerformanceTracking.PerfTracker.TryTrackActivity(String name, Action activity)
at nCrunch.Core.ProcessManagement.ExternalProcessManager.(ProcessorArchitecture , ProcessLoadParameters )


Remco
#15 Posted : Thursday, August 24, 2017 8:16:42 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 4,872

Thanks: 649 times
Was thanked: 756 time(s) in 721 post(s)
Thanks for clarifying all this. I have also had problems myself with running .NET Core applications under the local system account. This may be related to the local system account having all its user data stored under Windows\System32, which seems to cause some odd system level things to go wrong sometimes. At this stage, I'm not convinced this is a problem I can solve in NCrunch itself. I strongly recommend setting your CI to run under a non system account if you're running .NET Core tests. I've made a note to investigate this further.
GreenMoose
#16 Posted : Thursday, August 24, 2017 10:12:41 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 6/17/2012(UTC)
Posts: 312

Thanks: 48 times
Was thanked: 33 time(s) in 32 post(s)
Remco;11055 wrote:
I strongly recommend setting your CI to run under a non system account if you're running .NET Core tests. I've made a note to investigate this further.


Thanks, yes this what actually want to use. So, when creating a new user accounts (1 for tc agent, 1 for grid node) I initially tried to build solution with ncrunch console only and that ended up with the following issues:

* Only building with ncrunch console:
Quote:

[08:31:22] : [Step 1/1] [08:31:22.7255-InitialisationQueueTask-13] ERROR (Load): Error occurred during load of component at C:\TeamCity\buildAgent\work\969002e4bbebde55\Labs.Dotnetcore.Misc\test\Labs.Misc.DotnetTest2\Labs.Misc.DotnetTest2.csproj: System.Exception: An exception was thrown in the remote environment: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> nCrunch.Common.UserException: Errors occurred while trying to load the project file:
[08:31:22] : [Step 1/1] Assets file 'C:\TeamCity\buildAgent\work\969002e4bbebde55\Labs.Dotnetcore.Misc\test\Labs.Misc.DotnetTest2\obj\project.assets.json' not found. Run a NuGet package restore to generate this file.
[08:31:22] : [Step 1/1] Assets file 'C:\TeamCity\buildAgent\work\969002e4bbebde55\Labs.Dotnetcore.Misc\test\Labs.Misc.DotnetTest2\obj\project.assets.json' not found. Run a NuGet package restore to generate this file.
[08:31:22] : [Step 1/1] at nCrunch.Compiler.RemoteBuildRunner. (FilePath , LoadTimeQuery , String , String , DirectoryPath , String , String )
[08:31:22] : [Step 1/1] at nCrunch.Compiler.RemoteBuildRunner.AnalyseComponentBuild(ComponentLoadParameters parameters)
[08:31:22] : [Step 1/1] --- End of inner exception stack trace ---


* dotnet restore + ncrunch console:
Quote:

[08:39:05] : [Step 1/1] [08:39:05.4544-LocalBuildTask-11] ERROR (Internal): System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\TCAgent\.nuget\packages\Microsoft.NETCore.App'.
[08:39:05] : [Step 1/1] at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
[08:39:05] : [Step 1/1] at System.IO.FileSystemEnumerableIterator`1.CommonInit()
[08:39:05] : [Step 1/1] at System.IO.Directory.GetDirectories(String path)
[08:39:05] : [Step 1/1] at nCrunch.Common.IO.DirectoryPath.GetDirectories(String wildcardSpec)
[08:39:05] : [Step 1/1] at nCrunch.Core.PlatformTypes.DotNetCoreBuildExtender. (String )
[08:39:05] : [Step 1/1] at nCrunch.Core.PlatformTypes.DotNetCoreBuildExtender. (FilePath )
[08:39:05] : [Step 1/1] at nCrunch.Core.PlatformTypes.DotNetCoreBuildExtender. (SnapshotComponent , BuildOutput )
[08:39:05] : [Step 1/1] at nCrunch.Core.PlatformTypes.DotNetCoreBuildExtender.ProcessSuccessfulBuildOutput(SnapshotComponent component, BuildOutput buildOutput, IList`1 componentReferences)
[08:39:05] : [Step 1/1] at nCrunch.Core.BuildManagement.BuildEnvironment.Build(SnapshotComponent snapshotComponentToBuild, IList`1 referencedComponents, GridClientId gridClientId, IList`1 customEnvironmentVariables, IPlatformBuildExtender extender)
[08:39:05] : [Step 1/1] at nCrunch.Core.Processing.BuildTaskLogic.DoProcessTaskAndReturnSuccessFlag()
[08:39:05] : [Step 1/1] at nCrunch.Client.Processing.LocalProcessingTask.ProcessTaskAndReturnSuccessFlag()
[08:39:05] : [Step 1/1] at nCrunch.Client.Processing.ProcessingQueue. . ()


* dotnet restore + nuget restore (Using nuget.exe 4.1! Nuget 3.5 and nuget 4.3 do not restore the packages) + ncrunch console:
- Note: nuget 4.3 is required to build netcore2.0 app referencing netstandard2.0 to avoid nuget restore error like Project x is not compatible with netcoreapp2.0 (.NETCoreApp,Version=v2.0).
Quote:

...
<tons of nuget packages will get installed to c:\Users\TCAgent, including microsoft.netcore.app>
[11:27:04][Step 1/1] [09:27:04.4378-LocalAnalysisTask-22] ERROR (Internal): nCrunch.TaskRunner.Ipc.IpcConnectionClosedException: The connection has been closed
[11:27:04][Step 1/1] at nCrunch.TaskRunner.Ipc.Fast.IpcReader.Initialise()
...



Here it starts to get very "interesting":
1) Running NCRunch console within TC Agent with my normal admin user, everything works fine (1 test failure).
2) Running NCRunch console within TC Agent with my new TCAgent user, above Ipc exception is thrown.
3) Running NCRunch console outside TC Agent, with my new TCAgent user, NCrunch reports "Returning result: OK" (NOT expected - seems to not even be able to discover the tests?).
4) Running NCRunch console outside TC Agent, with my normal admin user, NCrunch reports "Returning result: TestFailure" (as expected).

NCrunch command used in all above scenarios:
Quote:

&"C:\Program Files (x86)\Remco Software\NCrunch Console Tool\NCrunch.exe" "C:\TeamCity\buildAgent\work\969002e4bbebde55\Labs.Dotnetcore.Misc\Labs.Misc.sln" -LogVerbosity Summary /O "C:\TeamCity\buildAgent\work\969002e4bbebde55\Labs.Dotnetcore.Misc\_NCrunch\Result" -WorkspaceBasePath "C:\TeamCity\buildAgent\work\969002e4bbebde55\Labs.Dotnetcore.Misc\_NCrunch\WC" -NCrunchCacheStoragePath "C:\TeamCity\buildAgent\work\969002e4bbebde55\Labs.Dotnetcore.Misc\_NCrunch\Cache"


:|

*Edit: Additioal tests I did which did not help for scenario 3: ensured c:\Users\...\.nuget\packages content was identical for both users, change TCAngent user to be admin.
*Edit2: Scenario 2 was fixed by copying packages folder between the 2 users so something seems to be missing there.
GreenMoose
#17 Posted : Thursday, August 24, 2017 12:39:20 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 6/17/2012(UTC)
Posts: 312

Thanks: 48 times
Was thanked: 33 time(s) in 32 post(s)
Found the missing package after x trial and errors: system.collections.nongeneric . Copying this voids the internal NCrunch exception, removing it introduces the exception.
( Also now my "scenario 3" is working properly (i.e. it reports TestFailure and not "Ok") ).
Remco
#18 Posted : Friday, August 25, 2017 4:48:39 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 4,872

Thanks: 649 times
Was thanked: 756 time(s) in 721 post(s)
Thanks for all the detailed info here. I'm busy pulling apart a few things around assembly referencing at the moment, so hopefully I can smooth much of this over. I'll let you know when an update is available.
Remco
#19 Posted : Sunday, August 27, 2017 2:57:35 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 4,872

Thanks: 649 times
Was thanked: 756 time(s) in 721 post(s)
GreenMoose
#20 Posted : Monday, August 28, 2017 6:30:56 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 6/17/2012(UTC)
Posts: 312

Thanks: 48 times
Was thanked: 33 time(s) in 32 post(s)
Remco;11081 wrote:
I believe I've managed to find solutions for all of these issues except for the scenario 3 one, which at present is still a mystery to me. Do let me know if you find a way to consistent reproduce this one.

Fixes are included in the build below:

http://downloads.ncrunch.net/NCrunch_Console_3.11.0.6.msi
...

I still experience the same issues with above version (i.e. if I have cleaned the Users\TCAgent\.nuget\packages folder ), e.g. the system.collections.nongeneric is missing.

And am I supposed to run both dotnetcore restore, and nuget restore, before invoking ncrunch.exe or should ncrunch.exe perform this logic by itself?
Users browsing this topic
Guest
2 Pages12>
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.477 seconds.