Hi,
I have found a new issue with testing ASP.NET Core project (2.0.0 as well as 1.1.2). I prepared a project where it is reproduced:
https://github.com/mdymel/NCrunchFalseNegative
Basically the integration tests fail when the startup class used for tests extends 'normal' Startup class.
Been watching this thread, but problems not resolved. No test are being discovered and there is a blue question mark beside all the projects (they are not being built).
VS15.3.3 and NCrunch 3.11.0.8
Repro here https://github.com/damianh/SqlStreamStore/tree/netstandard2
If any additional information needed, please let me know.
I see an error in the output when "Reload and rebuild selected compontent." . I don't know if related:
ENGINE - [23:59:27.5507-Core-28] Event [ComponentDataUpdatedEvent] is being processed on Core thread with subscriber: ImpactDetector.
[23:59:27.5697-EventReader-180] Event [ErrorEvent:[Error:
Context: (global)
Category: Internal
Message: NCrunch does not support recursive project references
Details: System.Exception: NCrunch does not support recursive project references
at nCrunch.Core.ComponentSorter.SortComponentsInBuildDependencyOrder(IList`1 components)
at nCrunch.Client.Model.EngineWorkflow.(CombinableComponentUpdateData )
at nCrunch.Client.Model.EngineWorkflow.ProcessComponentUpdate(IList`1 components, Boolean alwaysQueueDependencies, Boolean allowSlidingDelay)
at nCrunch.Client.Model.EngineWorkflow.(ComponentsAddedEvent )
]] is being published on thread CoreThread to subscriber: ErrorHandler.
ENGINE - [23:59:27.5507-Core-28] Event [ComponentDataUpdatedEvent] is being processed on Core thread with subscriber: TestTreeSynchroniser.
I've removed all projects except one and it has not project references so I am unable to figure out what this might mean.
Thanks for sharing the source code demonstrating the problem, this always makes things easier. This problem looks to be caused by a referencing issue in your solution. The solution has a Directory.Build.props file at its base, which by MSBuild convention is automatically included in the build system for each project in the solution. This file declares a reference to the primary project in the solution, as such:
Because the file is implicitly included in SqlStreamStore.csproj itself, this creates a self reference inside the build system, creating a recursive structure that NCrunch can't handle. The reference also duplicates other references in the solution, creating some interesting warnings in the VS UI.
I am actually quite surprised that VS is able to build this solution. It must have some filter to remove these sorts of things.
When I removed the project reference from the .props file, everything seemed to work OK.
Thanks for sharing this problem. This is being caused by a .deps file generation issue in NCrunch related to the AspNet.TestHost library. A code fix will be required to resolve this problem. I'll let you know as soon as I have a fixed build available.
> Because the file is implicitly included in SqlStreamStore.csproj itself, this creates a self reference inside the build system, creating a recursive structure that NCrunch can't handle.
Bah!
Sorry I wasted your time.
> I am actually quite surprised that VS is able to build this solution. It must have some filter to remove these sorts of things.
Yeah VS, VS Test Runner, Resharper Test runner, Rider and CLI all worked :/
Edit: perhaps NCrunch should be less strict here, if the others handle it gracefully? Just a thought. Low priority.
damianh wrote:
Yeah VS, VS Test Runner, Resharper Test runner, Rider and CLI all worked :/
Edit: perhaps NCrunch should be less strict here, if the others handle it gracefully? Just a thought. Low priority.
When this area of NCrunch was built, such a recursive structure was impossible to build using any of the UI tools in VS, and coding it in manually would prevent VS from even opening the solution.
Times are changing indeed. I've made a note to make the error a bit less internal, so it can be easily seen and corrected.
.NET Core/Standard 2.0 Grid Node Build is totally broken. With 3.11.9/5 it worked before.
The NuGet Package Resolution seems broken. I'm getting weird of missing NuGet Packages in my UserProfile, and from the Visual Studio Installation Path.
Yes, the errors are technically correct (it is an other Version of VS2017 installed on the Grid Node System, in this case the preview) and the nuget packages (.NET Standard 2.0 and others) are not in the
User Profile (for whatever reason - i don't know - there are in different folders, the Grid Node Server than on my local machine). But the normal dotnet build is running, so the the must be available on the system ;)
I installed the same Version of VS 2017 with the same toolset on the Grid Node, and i copied my complete user profile nuget package folder to the Grid Node User Profile Nuget Package Folder (the Grid node runs under then same Account as the VS and the local user).
So the missing packages are now gone. but it still builds not.
NCrunch: This project was built on server 'DELL-E-6420'
WithFakes.cs (9, 55): The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
WithFakes.cs (9, 55): The type 'IList<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
WithFakes.cs (9, 55): The type 'ICollection<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
WithFakes.cs (9, 55): The type 'IEnumerable<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
WithFakes.cs (9, 55): The type 'IEnumerable' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
FakeFactory.cs (20, 68): The type 'IList<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
FakeFactory.cs (20, 68): The type 'ICollection<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
FakeFactory.cs (20, 68): The type 'IEnumerable<>' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
FakeFactory.cs (20, 68): The type 'IEnumerable' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
FakeFactory.cs (20, 59): 'ServiceProvider ServiceCollectionContainerBuilderExtensions.BuildServiceProvider(IServiceCollection)' has the wrong return type
FakeFactory.cs (20, 59): The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
FakeFactory.cs (20, 59): The type 'IServiceProvider' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
FakeFactory.cs (20, 59): The type 'IDisposable' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
FakeFactory.cs (72, 24): The type 'ConstructorInfo' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
SubjectFactory.cs (61, 33): The type 'ConstructorInfo' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
SubjectFactory.cs (63, 20): The type 'ConstructorInfo' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
Yes, it builds and runs find on my local machine with NCrunch. And builds fine on the grid node with 'dotnet build'.
I deleted all Build Folders from the Grid Node Server, did not help.
.NET Core 1.1/Standard 1.x are building and testing fine on the same system.
3.12.1 does not fix this problem. Also, i'm sure .NET Standard 2.0 Builds worked in an earlier version of 3.11 and the same machine. Now we moved all our .NET Core/.NET Standard Projects to 2.0 and i have to run the test locally on my machine instead of the node. which hurts the performance a little bit.
Can you confirm whether the grid node is running as local system, or a user account? I remember encountering some strange behaviour when trying to build and run tests under the system profile, because this stores the nuget package cache under Windows\System32 (a bad thing).
Of interest is also whether the projects situated in the NCrunch workspace on the grid node can be built using command-line MSBuild.exe. Trying to get them to build and comparing them with their foreground equivalents is a good way to troubleshoot this problem, as you can deductively figure out where NCrunch has gone wrong in setting up these files.
Because grid processing under .NET standard 2.0 seems to be working for all my test cases, I believe there is a fundamental different in the environment on your grid node that must be triggering this issue. If we can find this difference, I should be able to reproduce and resolve the issue.
of course .... first thought "Running not as a Service, i switched that to the Local User Account and it worked".... well, lets take a look to be sure. No, is running under local System. WTF.
So one of the Upgrade Installs, uninstalls, and reinstalls killed the LogOn Account Data which i entered some time ago. I entered it again. and now it works.
Maybe you should ask for account data while the installation (or do you?).
Der-Albert.com wrote:
of course .... first thought "Running not as a Service, i switched that to the Local User Account and it worked".... well, lets take a look to be sure. No, is running under local System. WTF.
So one of the Upgrade Installs, uninstalls, and reinstalls killed the LogOn Account Data which i entered some time ago. I entered it again. and now it works.
Maybe you should ask for account data while the installation (or do you?).
Sorry, the installer always sets the user to the local system account, even for upgrades, annoyingly. There is a task in the backlog to address this. I guess now that we have a major platform that doesn't run under local system, the task is becoming more urgent. For the time being, this is one to watch out for when you upgrade the grid node.
Der-Albert.com wrote:
of course .... first thought "Running not as a Service, i switched that to the Local User Account and it worked".... well, lets take a look to be sure. No, is running under local System. WTF.
So one of the Upgrade Installs, uninstalls, and reinstalls killed the LogOn Account Data which i entered some time ago. I entered it again. and now it works.
Maybe you should ask for account data while the installation (or do you?).
Sorry, the installer always sets the user to the local system account, even for upgrades, annoyingly. There is a task in the backlog to address this. I guess now that we have a major platform that doesn't run under local system, the task is becoming more urgent. For the time being, this is one to watch out for when you upgrade the grid node.
I'm going to lock this topic now, because it's becoming a catch-all for every problem even vaguely related to .NET Core and .NET Standard. I hope that we're most of the way there now towards full compatibility with this platform. If anyone is still experiencing problems, please create a new thread with a more specific topic to report the problem. Thanks!