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

Notification

Icon
Error

Load Failure
spolonski
#1 Posted : Tuesday, December 1, 2020 3:36:57 PM(UTC)
Rank: Member

Groups: Registered
Joined: 7/11/2016(UTC)
Posts: 22
Location: Germany

Thanks: 5 times
Was thanked: 2 time(s) in 2 post(s)
On our BuildServer we are getting a following error:

Code:
Result:Load Failure

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:
The "GetRestoreProjectStyleTask" task could not be instantiated from the assembly "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\CommonExtensions\Microsoft\NuGet\NuGet.Build.Tasks.dll". Please verify the task assembly has been built using the same version of the Microsoft.Build.Framework assembly as the one installed on your computer and that your host application is not missing a binding redirect for Microsoft.Build.Framework. Unable to cast object of type 'NuGet.Build.Tasks.GetRestoreProjectStyleTask' to type 'Microsoft.Build.Framework.ITask'.
The "GetRestoreProjectStyleTask" task has been declared or used incorrectly, or failed during construction. Check the spelling of the task name and the assembly name.
at nCrunch.Compiler.ComponentAnalysisContext.()
at nCrunch.Compiler.ComponentAnalysisContext.AnalyseComponentBuild()
at nCrunch.Compiler.RemoteBuildRunner.AnalyseComponentBuild(ComponentLoadParameters parameters)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at nCrunch.TaskRunner.Ipc.IpcMessageProcessor.(CallMethodMessage )
at nCrunch.TaskRunner.Ipc.IpcMessageProcessor.ProcessMessageReturningResult(Byte[] data)
at nCrunch.TaskRunner.Ipc.RemoteInstance.(Byte[] )
at nCrunch.TaskRunner.Ipc.RemoteInstance.Invoke(IMessage msg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at nCrunch.Compiler.IRemoteBuildRunner.AnalyseComponentBuild(ComponentLoadParameters parameters)
at nCrunch.Core.BuildManagement.BuildProcessLauncher..(IRemoteBuildRunner )
at nCrunch.Core.BuildManagement.BuildProcessLauncher.(Action`1 , FilePath , String , ExternalProcess )
at nCrunch.Core.BuildManagement.BuildProcessLauncher.(Action`1 , EffectiveProcessorArchitecture , GridClientId , BuildSystemParameters , IList`1 , Nullable`1 , GridAddress )
at nCrunch.Core.BuildManagement.BuildProcessLauncher.AnalyseComponentBuildInExternalProcess(ComponentLoadParameters parameters, IList`1 customEnvironmentVariables)
at nCrunch.Client.ComponentLoader.SnapshotComponentLoader.(EffectiveProcessorArchitecture , String )
at nCrunch.Client.ComponentLoader.SnapshotComponentLoader.CreateComponentFromXml(FilePath projectFilePath, ParsedBuildXml projectXml, FilePath solutionFilePath, String[] additionalFilesToIncludeAtSolutionLevel, Boolean isLoadedFromFile, VisualStudioVersion vsVersion, ComponentUniqueName componentName, TaskSettings componentTaskSettings, Exception parseException, String targetFramework)


On my dev machine, if i use the same cli command to start ncrunch and use the same grid server, it works without Problem.
Can you help me please to find out what is going wrong?
Remco
#2 Posted : Tuesday, December 1, 2020 11:28:40 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 852 times
Was thanked: 1155 time(s) in 1079 post(s)
Hi, thanks for sharing this issue.

This looks to me like an install state issue. I think the build system is trying to wire in resources from two different versions of VS2019.

Do you have the build tools installed on this machine? Or another version of VS?
spolonski
#3 Posted : Thursday, December 2, 2021 7:47:43 AM(UTC)
Rank: Member

Groups: Registered
Joined: 7/11/2016(UTC)
Posts: 22
Location: Germany

Thanks: 5 times
Was thanked: 2 time(s) in 2 post(s)
Hi Remco,

I found some new Informations about this Problem

The error does not occur every time, often everything works as it should.
I was able to make 2 detailed logs: one with error and one without.
I found that, on run with the error, logs with a message "Added binding redirect for: Microsoft.Build.Framework" are missing

I have provided Logs with contact form.

Remco
#4 Posted : Thursday, December 2, 2021 9:12:35 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 852 times
Was thanked: 1155 time(s) in 1079 post(s)
Thanks for sending this through. Could you confirm for me if you have the NCrunch 'Build process CPU architecture' setting set to a consistent value for all the projects in your solution, and if not, does setting this to the same thing for all projects resolve the issue?
spolonski
#5 Posted : Thursday, December 2, 2021 10:11:00 AM(UTC)
Rank: Member

Groups: Registered
Joined: 7/11/2016(UTC)
Posts: 22
Location: Germany

Thanks: 5 times
Was thanked: 2 time(s) in 2 post(s)
Yes, It is set in config.xml
Code:

<GlobalConfiguration>
  <Settings>
    <BuildProcessArchitecture>x64</BuildProcessArchitecture>
    <EngineHostingStrategy>x86SatelliteProcess</EngineHostingStrategy>
    <FastLaneThreads>0</FastLaneThreads>
    <GridServerReferencesForComputer>
[...]
    </GridServerReferencesForComputer>
    <DisabledNodes>
      <Value>(local):0</Value>
    </DisabledNodes>
    <MaxNumberOfProcessingThreads>5</MaxNumberOfProcessingThreads>
    <MaxTestRunnerProcessesToPool>1</MaxTestRunnerProcessesToPool>
    <SlidingBuildDelayInMilliseconds>600</SlidingBuildDelayInMilliseconds>
    <SystemConfigured>True</SystemConfigured>
    <TerminateTestRunnerTasksOnExecutionComplete>False</TerminateTestRunnerTasksOnExecutionComplete>
    <UseSimplifiedSettingsWhereAvailable>False</UseSimplifiedSettingsWhereAvailable>
    <NCrunchCacheStoragePath>%TEMP%\NCrunchCache</NCrunchCacheStoragePath>
    <TestsToExecuteAutomatically>(DoesNotHaveCategory 'ManualTest' AND DoesNotHaveCategory 'WeakReferenceTest')</TestsToExecuteAutomatically>
  </Settings>
  <EngineModes>
    <EngineMode>
      <Name>Run all CI tests automatically</Name>
      <Settings>
        <TestsToExecuteAutomatically>(DoesNotHaveCategory 'ManualTest' AND DoesNotHaveCategory 'WeakReferenceTest')</TestsToExecuteAutomatically>
      </Settings>
    </EngineMode>
  </EngineModes>
</GlobalConfiguration>
Remco
#6 Posted : Thursday, December 2, 2021 11:36:15 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 852 times
Was thanked: 1155 time(s) in 1079 post(s)
The logs indicated that this setting is overridden for a number of the projects in your solution.

I've identified an issue that can cause erroneous behaviour when the setting has different values between projects.

Does removing the setting value at project level for all your projects (thus making it consistent) resolve the problem?
spolonski
#7 Posted : Thursday, December 2, 2021 1:18:03 PM(UTC)
Rank: Member

Groups: Registered
Joined: 7/11/2016(UTC)
Posts: 22
Location: Germany

Thanks: 5 times
Was thanked: 2 time(s) in 2 post(s)
Remco;15850 wrote:
The logs indicated that this setting is overridden for a number of the projects in your solution.

I've identified an issue that can cause erroneous behaviour when the setting has different values between projects.

Does removing the setting value at project level for all your projects (thus making it consistent) resolve the problem?

No, it doesn't. Do you need a new detailed logs of problem?
Remco
#8 Posted : Friday, December 3, 2021 1:36:43 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 852 times
Was thanked: 1155 time(s) in 1079 post(s)
Thanks for confirming this. I'm wondering if you can check the following for me:

- Is there any difference if you specify the version of Visual Studio to be used by the console tool through the /VS parameter?
- Which versions of Visual Studio or the MSBuild tools do you have installed on your build server?
- Can you check if there are any directories inside "C:\Users\f-tfsbuild\AppData\Local\NCrunch\BuildSystem" while your build isn't running? If so, does clearing these out make any difference?
spolonski
#9 Posted : Friday, December 3, 2021 9:04:37 AM(UTC)
Rank: Member

Groups: Registered
Joined: 7/11/2016(UTC)
Posts: 22
Location: Germany

Thanks: 5 times
Was thanked: 2 time(s) in 2 post(s)
Remco;15854 wrote:
Thanks for confirming this. I'm wondering if you can check the following for me:

- Is there any difference if you specify the version of Visual Studio to be used by the console tool through the /VS parameter?
No.
Remco;15854 wrote:
- Which versions of Visual Studio or the MSBuild tools do you have installed on your build server?
VS Professional 2019 16.7.7
Remco;15854 wrote:
- Can you check if there are any directories inside "C:\Users\f-tfsbuild\AppData\Local\NCrunch\BuildSystem" while your build isn't running?
Yes, There are some directories.
Remco;15854 wrote:
If so, does clearing these out make any difference?
It helps. I did 10 runs and all were successful.
PS. After each run was a new directory under C:\Users\f-tfsbuild\AppData\Local\NCrunch\BuildSystem created.
Remco
#10 Posted : Saturday, December 4, 2021 12:29:27 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 852 times
Was thanked: 1155 time(s) in 1079 post(s)
spolonski
#11 Posted : Monday, December 6, 2021 7:49:43 AM(UTC)
Rank: Member

Groups: Registered
Joined: 7/11/2016(UTC)
Posts: 22
Location: Germany

Thanks: 5 times
Was thanked: 2 time(s) in 2 post(s)
Remco;15857 wrote:
Could you try the build below and let me know if it solves the problem for you?
Sorry, i can't reproduce it anymore. I have not saved files from the directory C:\Users\f-tfsbuild\AppData\Local\NCrunch\BuildSystem
Remco
#12 Posted : Monday, December 6, 2021 12:14:35 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 852 times
Was thanked: 1155 time(s) in 1079 post(s)
spolonski;15859 wrote:
Sorry, i can't reproduce it anymore. I have not saved files from the directory C:\Users\f-tfsbuild\AppData\Local\NCrunch\BuildSystem


Fair enough :)

The fix included in this build makes NCrunch more resilient to corruption of this particular directory. I think this problem was caused by failed cleanup (probably due to file locks) which left the BuildSystem directories in an invalid state. Because they hung around, it was just a matter of time until a new process spawned with the same ID as the broken directory and assumed ownership of it.

NCrunch will now fix up the directory if it exists in an unexpected state. So in theory, under the new build you should never see this problem again.
1 user thanked Remco for this useful post.
spolonski on 12/6/2021(UTC)
Users browsing this topic
Guest
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.082 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download