I am having an issue where ncrunch is failing to build my .net core projects. Haven't been able to find anything online regarding this particular issue.
Anyone else run into this before? Currently, I am running VS 2017 15.6.0 Preview 3.
Thanks for confirming. Are you able to build a sample project that can produce the error (something you can share with me)? You can submit zipped code through the contact form.
If you have a non preview build of VS2017 installed, I'd also be interested to know if the same project works correctly on the non-preview build.
Local 15.6 Preview 3.0, some projets are not building with the error in the screenshot. On my Grid Node i have still 15.6 Preview 2.0 on this same same solution builds and run.
I can also confirm that the solution built okay with 15.6 Preview 2.0 as well. I installed 15.5 this morning, and everything works as expected. I will stay on this version in the mean time.
I've tried to reproduce this in a test project. I've updated my visual studio to the latest preview build and created a classlibrary targetting netcore 2.0. I've added a NUnit3 test to that. NCrunch and VS are still able to build that solution.
Can someone help me out and reproduce this with a small test project? (Or report the steps taken)
michaelkroes wrote:Can someone help me out and reproduce this with a small test project? (Or report the steps taken)
File New Project=> .NET Core => ASP.NET Web Application => MVC (Not Authentication) => Enable NCrunch
Build Failue
NCrunch: If you are experiencing problems in getting this project to build, have a look at http://www.ncrunch.net/documentation/troubleshooting_project-build-issues
NCrunch: This project was built on server '(local)'
..\..\..\Program Files\dotnet\sdk\2.1.100-preview-007354\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.targets (155, 5): The "GenerateRuntimeConfigurationFiles" task failed unexpectedly.
System.NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
bei Newtonsoft.Json.Utilities.DynamicReflectionDelegateFactory.GenerateCreateSetPropertyIL(PropertyInfo propertyInfo, ILGenerator generator)
bei Newtonsoft.Json.Utilities.DynamicReflectionDelegateFactory.CreateSet[T](PropertyInfo propertyInfo)
bei Newtonsoft.Json.Utilities.ReflectionDelegateFactory.CreateSet[T](MemberInfo memberInfo)
bei Newtonsoft.Json.Serialization.DefaultContractResolver.SetExtensionDataDelegates(JsonObjectContract contract, MemberInfo member)
bei Newtonsoft.Json.Serialization.DefaultContractResolver.CreateObjectContract(Type objectType)
bei Newtonsoft.Json.Serialization.DefaultContractResolver.CreateContract(Type objectType)
bei Newtonsoft.Json.Serialization.DefaultContractResolver.ResolveContract(Type type)
bei Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.CalculatePropertyValues(JsonWriter writer, Object value, JsonContainerContract contract, JsonProperty member, JsonProperty property, JsonContract& memberContract, Object& memberValue)
bei Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
bei Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty)
bei Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType)
bei Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value, Type objectType)
bei Microsoft.NET.Build.Tasks.GenerateRuntimeConfigurationFiles.WriteToJsonFile(String fileName, Object value)
bei Microsoft.NET.Build.Tasks.GenerateRuntimeConfigurationFiles.WriteRuntimeConfig(ProjectContext projectContext)
bei Microsoft.NET.Build.Tasks.GenerateRuntimeConfigurationFiles.ExecuteCore()
bei Microsoft.NET.Build.Tasks.TaskBase.Execute()
bei Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
bei Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
michaelkroes wrote:Can someone help me out and reproduce this with a small test project? (Or report the steps taken)
File New Project=> .NET Core => ASP.NET Web Application => MVC (Not Authentication) => Enable NCrunch
Build Failue
NCrunch: If you are experiencing problems in getting this project to build, have a look at http://www.ncrunch.net/documentation/troubleshooting_project-build-issues
NCrunch: This project was built on server '(local)'
..\..\..\Program Files\dotnet\sdk\2.1.100-preview-007354\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.targets (155, 5): The "GenerateRuntimeConfigurationFiles" task failed unexpectedly.
System.NullReferenceException: Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
bei Newtonsoft.Json.Utilities.DynamicReflectionDelegateFactory.GenerateCreateSetPropertyIL(PropertyInfo propertyInfo, ILGenerator generator)
bei Newtonsoft.Json.Utilities.DynamicReflectionDelegateFactory.CreateSet[T](PropertyInfo propertyInfo)
bei Newtonsoft.Json.Utilities.ReflectionDelegateFactory.CreateSet[T](MemberInfo memberInfo)
bei Newtonsoft.Json.Serialization.DefaultContractResolver.SetExtensionDataDelegates(JsonObjectContract contract, MemberInfo member)
bei Newtonsoft.Json.Serialization.DefaultContractResolver.CreateObjectContract(Type objectType)
bei Newtonsoft.Json.Serialization.DefaultContractResolver.CreateContract(Type objectType)
bei Newtonsoft.Json.Serialization.DefaultContractResolver.ResolveContract(Type type)
bei Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.CalculatePropertyValues(JsonWriter writer, Object value, JsonContainerContract contract, JsonProperty member, JsonProperty property, JsonContract& memberContract, Object& memberValue)
bei Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
bei Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty)
bei Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType)
bei Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value, Type objectType)
bei Microsoft.NET.Build.Tasks.GenerateRuntimeConfigurationFiles.WriteToJsonFile(String fileName, Object value)
bei Microsoft.NET.Build.Tasks.GenerateRuntimeConfigurationFiles.WriteRuntimeConfig(ProjectContext projectContext)
bei Microsoft.NET.Build.Tasks.GenerateRuntimeConfigurationFiles.ExecuteCore()
bei Microsoft.NET.Build.Tasks.TaskBase.Execute()
bei Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
bei Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
Thank you for this! I've got it reproduced and will look into it.
Hi,
I took a look at this issue and I wonder if it could be casued by an older bug in Newtonsoft.Json that was fixed a few years ago:
https://github.com/JamesNK/Newtonsoft.Json/issues/508
From what I see, NCrunch bundles a copy of Newtonsoft.Json.dll 6.0.8.18111 which may explain this issue (I used the manual installation instructions).
Thanks,
Adrian Vinca
Software Engineer - Microsoft Visual Studio IDE
Thanks for taking the time to post here! You are absolutely correct. We had, actually, just a couple of hours earlier arrived at the exact same conclusion ourselves and we're in the process of fixing the problem. Including 3rd party assemblies in the NCrunch build system is something we should be trying to avoid anyway (for these kinds of reasons), so we're taking steps to remove the dependency. We should have a fix for this coming in NCrunch v3.13.
My assumption is that replacing NCrunch's packaged copy of Newtonsoft.Json in an installation of NCrunch would probably work around the problem if waiting for v3.13 isn't an option (note: I haven't yet tested this).
Remco wrote:My assumption is that replacing NCrunch's packaged copy of Newtonsoft.Json in an installation of NCrunch would probably work around the problem if waiting for v3.13 isn't an option (note: I haven't yet tested this).
Your assumption seems right, I replaced Newtonsoft.Json with the current 10.0.3 Version (net45) and quick test builds the complete solution and runs all tests.
Btw. the Grid Node Server does not have this problem. I've updated to 15.6 Preview 4 on the Grid Node (no NCrunch installed in VS), and swapped the Newtonsoft.Json in the Install Folder of the Grid Node.
NCrunch: This project was built on server 'DELL-E-6420'
NCrunch: The tests in this project were discovered on server 'DELL-E-6420'
An error occurred while analysing this project after it was built: NCrunch encountered an unexpected error occurred while building an environment to analyse an assembly: System.IO.FileLoadException: Could not load file or assembly 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'
at nCrunch.Compiler.ProjectAssetsJson.FindRuntimeAssemblies(String platformName, String packageName, String packageVersion)
at nCrunch.Core.PlatformTypes.DotNetClassicPlatformType.GetRuntimeAssemblyReference(SnapshotComponent component, FilePath reference)
at nCrunch.Core.TestManagement.TestProcessReferenceResolver.ResolveReferencesForTestProcess(SnapshotComponent primaryComponent, IList`1 allComponentsInProcess)
at nCrunch.Core.TestManagement.TestRunnerProcess.()
at nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
at nCrunch.Core.TestManagement.TestRunnerProcess.LoadTestRunnerProcessForProjectReturningProcessId(SnapshotComponent snapshotComponent, IList`1 componentsInProcess, TestFrameworkDescription[] testingFrameworks, Nullable`1 newProcessTag, FilePath solutionFilePath, GridClientId client, CustomEnvironmentVariable[] customEnvironmentVariables)
at nCrunch.Core.Processing.AnalysisTaskLogic.DoProcessTaskAndReturnSuccessFlag()
WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
Ok, switched back to the old one and it still worked.
It worked with Preview 2.0, I did not check if it works after the Update to Preview 4.0, i directly switched to a newer NewtonSoft.Json.
Sadly, that it works in the Grid Node is not enterly true. It depends on the Project. Same error as in VS (which makes more Sense that my described behavior)