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

Notification

Icon
Error

The FrameworkReference 'Microsoft.WindowsDesktop.App.WPF' was not recognized
eriove
#1 Posted : Tuesday, April 21, 2020 8:31:26 AM(UTC)
Rank: Member

Groups: Registered
Joined: 3/22/2016(UTC)
Posts: 20
Location: Sweden

Thanks: 13 times
Was thanked: 2 time(s) in 2 post(s)
First of all thanks for an amazing product!

We've had a problem for a while with some of our WPF projects targeting .NET Framework 4.8 and .NET Core 3.1. I've been hoping that it would have been a WPF on .NET Core problem but the more patched .NET Core get the more I suspect that it is something nCrunch related. We are using C# 8.0 and nullable reference types with .NET 4.8 which isn't supported so that could also be the culprit.

The problem is intermittent and is most often triggered when changing branches (even if the project files doesn't change) and is always resolved by restarting the nCrunch engine. I have not managed to trigger it with a small solution but I will e-mail you our project files.

Here's the stack trace:

Code:

NCrunch: This project was built on server '(local)'
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 FrameworkReference 'Microsoft.WindowsDesktop.App.WPF' was not recognized
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)


Interestingly enough projects depending on the one that has a "Load failure" fails like types were missing in the referenced assembly instead of failing because the referenced assembly failed to compile.

I'm e-mailing you the projects (without any code)
Remco
#2 Posted : Tuesday, April 21, 2020 8:38:57 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 787 times
Was thanked: 1023 time(s) in 974 post(s)
Hi, thanks for sharing this problem.

I'll take a look at the sample solution and will get back to you. Can you confirm that you're running the latest version of NCrunch? (v4.3).
eriove
#3 Posted : Tuesday, April 21, 2020 8:40:53 AM(UTC)
Rank: Member

Groups: Registered
Joined: 3/22/2016(UTC)
Posts: 20
Location: Sweden

Thanks: 13 times
Was thanked: 2 time(s) in 2 post(s)
I'm running 4.4.0.2, I was hoping that that version would solve the problem. Had the same problem on 4.3.
Remco
#4 Posted : Wednesday, April 22, 2020 2:35:02 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 787 times
Was thanked: 1023 time(s) in 974 post(s)
2 users thanked Remco for this useful post.
eriove on 4/22/2020(UTC), DeltaEngine on 4/23/2020(UTC)
eriove
#7 Posted : Wednesday, April 22, 2020 6:56:53 AM(UTC)
Rank: Member

Groups: Registered
Joined: 3/22/2016(UTC)
Posts: 20
Location: Sweden

Thanks: 13 times
Was thanked: 2 time(s) in 2 post(s)
Thanks! I will test during the day. Looking good for the first 20 minutes, but the error has been intermittent. Will try to provoke it by branch changes and edits to project files.
eriove
#8 Posted : Wednesday, April 22, 2020 7:03:31 AM(UTC)
Rank: Member

Groups: Registered
Joined: 3/22/2016(UTC)
Posts: 20
Location: Sweden

Thanks: 13 times
Was thanked: 2 time(s) in 2 post(s)
Unfortunately I triggered the error again at the first switch of branch. Exactly the same stack trace as in the first post.
eriove
#9 Posted : Wednesday, April 22, 2020 3:16:11 PM(UTC)
Rank: Member

Groups: Registered
Joined: 3/22/2016(UTC)
Posts: 20
Location: Sweden

Thanks: 13 times
Was thanked: 2 time(s) in 2 post(s)
I've experimented throughout the day. These are my conclusions:
- "Reload and rebuild selected component" does not help resolving the problem, I have to "Restart the nCrunch engine" to resolve the problem.
- The .NET Core builds never fail only the .NET Framework builds.
- Switching branch is the best way to trigger the problem but working in a single file has triggered it at least once.
Remco
#10 Posted : Thursday, April 23, 2020 12:17:06 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 787 times
Was thanked: 1023 time(s) in 974 post(s)
Thanks for the extra info. I'm still trying to work out what is happening here ... I was so sure I'd fixed this one. Can you confirm the version number of NCrunch that you have showing in the 'About' window?
eriove
#11 Posted : Thursday, April 23, 2020 6:34:32 AM(UTC)
Rank: Member

Groups: Registered
Joined: 3/22/2016(UTC)
Posts: 20
Location: Sweden

Thanks: 13 times
Was thanked: 2 time(s) in 2 post(s)
The version in the about window says 4.4.0.7. The nCrunch.BuildHost48.x86.exe and nCrunch.TestHost48.x86.exe is has the Product and File version 4.4.0.7.

My feeling is that the error occurs much less often with 4.4.0.7 than the previous version. Perhaps there are two ways of reaching the same stack trace and you have found one of them?

I just got the error for a test project that has <Project Sdk="Microsoft.NET.Sdk"> and not <Project Sdk="Microsoft.NET.Sdk.WindowsDesktop"> on the first line of the project file (FOI.ShipDes.Tests in the files I sent you). Posting the tack trace again in case I missed a subtle difference somewhere. I got the error from switching branch this time as well.

Noteworthy with the branches is that the one I switched to uses version 4.10.0 of Dirkster99.AvalonDock but the one I switched from uses version 3.6.2. What's special about this switch is that 4.x has the same DLL name but different namespaces. Now and then when switching branches I have to delete the bin and obj folders for the project to run in Visual Studio.

Code:

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 FrameworkReference 'Microsoft.WindowsDesktop.App.WPF' was not recognized
The FrameworkReference 'Microsoft.WindowsDesktop.App' was not recognized
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)

eriove
#12 Posted : Thursday, April 23, 2020 6:57:17 AM(UTC)
Rank: Member

Groups: Registered
Joined: 3/22/2016(UTC)
Posts: 20
Location: Sweden

Thanks: 13 times
Was thanked: 2 time(s) in 2 post(s)
Got the error again while switching between two branches with Dirkster99.AvalonDock version 3.6.2 on both branches, so that might be unrelated.
DeltaEngine
#5 Posted : Thursday, April 23, 2020 11:52:27 PM(UTC)
Rank: Member

Groups: Registered
Joined: 11/23/2012(UTC)
Posts: 21
Location: Germany

Thanks: 3 times
Was thanked: 1 time(s) in 1 post(s)


Cool, thanks, fixed it for us as well. Just a quick report from us, we had similar problems with IpcConnectionClosedException, also with WPF projects as well:

nCrunch 4.3.0.13
- solution with 30 projects, around 3500 tests, no wpf, tried 3 times, loads without any errors.

- solution with 60 projects, around 10 of them with wpf, loaded 3 times, first almost all projects fail to load with "nCrunch.TaskRunner.Ipc.IpcConnectionClosedException: The connection has been closed", then again, about 2-3 fail, then all compile

- solution with mostly wpf projects randomly fail and work, for some reason seems to be better with smaller solutions (<20 projects) than our 60 project solution.

- using a solution filter or unloading wpf projects makes it immediately work and is repeatable.

Tried nCrunch 4.4.0.7 and all of the above issues seem to be gone. It is a bit difficult to be 100% sure as once the problems are fixed, they don't come back until the next merge or project reload (reloaded a few times and tested different solutions, all without problems right now).
DeltaEngine
#6 Posted : Friday, April 24, 2020 12:22:43 AM(UTC)
Rank: Member

Groups: Registered
Joined: 11/23/2012(UTC)
Posts: 21
Location: Germany

Thanks: 3 times
Was thanked: 1 time(s) in 1 post(s)
DeltaEngine;14669 wrote:
Remco;14657 wrote:
Could you try the build below and confirm whether this solves the issue for you?
...


Cool, thanks, fixed it for us as well. Just a quick report from us, we had similar problems with IpcConnectionClosedException, also with WPF projects as well:

nCrunch 4.3.0.13
- solution with 30 projects, around 3500 tests, no wpf, tried 3 times, loads without any errors.

- solution with 60 projects, around 10 of them with wpf, loaded 3 times, first almost all projects fail to load with "nCrunch.TaskRunner.Ipc.IpcConnectionClosedException: The connection has been closed", then again, about 2-3 fail, then all compile

- solution with mostly wpf projects randomly fail and work, for some reason seems to be better with smaller solutions (<20 projects) than our 60 project solution.

- using a solution filter or unloading wpf projects makes it immediately work and is repeatable.

Tried nCrunch 4.4.0.7 and all of the above issues seem to be gone. It is a bit difficult to be 100% sure as once the problems are fixed, they don't come back until the next merge or project reload (reloaded a few times and tested different solutions, all without problems right now).


Sadly it happened again, but only on 2 of the test projects that also have WPF dependencies, reloading also does not make the problem go away, so we excluded the projects from NCrunch for now (via Ignore this component completely):
Quote:

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: nCrunch.TaskRunner.Ipc.IpcConnectionClosedException: The connection has been closed
at nCrunch.Core.ProcessManagement.ExternalProcessManager.(EffectiveProcessorArchitecture , ProcessLoadParameters )
at nCrunch.Core.ProcessManagement.ExternalProcessManager.LoadExternalProcess(ProcessLoadParameters parameters, GridClientId client)
at nCrunch.Core.TestManagement.TestRunnerProcess..()
at nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
at nCrunch.Core.TestManagement.TestRunnerProcess.(Nullable`1 , FilePath , GridClientId , CustomVariable[] )
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, CustomVariable[] customEnvironmentVariables)
at nCrunch.Core.Processing.AnalysisTaskLogic.DoProcessTaskAndReturnSuccessFlag()
Remco
#13 Posted : Friday, April 24, 2020 11:16:30 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 787 times
Was thanked: 1023 time(s) in 974 post(s)
1 user thanked Remco for this useful post.
eriove on 4/24/2020(UTC)
eriove
#14 Posted : Friday, April 24, 2020 1:51:16 PM(UTC)
Rank: Member

Groups: Registered
Joined: 3/22/2016(UTC)
Posts: 20
Location: Sweden

Thanks: 13 times
Was thanked: 2 time(s) in 2 post(s)
I've switched branches multiple times and just when I wrote this message I got the error for the first time. But, it disappeared by itself after 10 seconds so the only reason I saw it was that I looked at the nCrunch window. Even if the problem isn't solved to 100% the error is certainly occurring less often. I will post an update next week letting you know if I see the error again.
Remco
#15 Posted : Friday, April 24, 2020 11:49:11 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 787 times
Was thanked: 1023 time(s) in 974 post(s)
eriove;14675 wrote:
I've switched branches multiple times and just when I wrote this message I got the error for the first time. But, it disappeared by itself after 10 seconds so the only reason I saw it was that I looked at the nCrunch window. Even if the problem isn't solved to 100% the error is certainly occurring less often. I will post an update next week letting you know if I see the error again.


The build above contains a separate workaround for an issue where we weren't detecting project file changes under VS2019.16.5. This is/was due to a bug present in the IDE. It's quite possible that a number of these issues are actually related to NCrunch becoming desynchronised with the state of the project and not being able to update itself. If the error goes away on its own, this means that NCrunch tried to load the project while it was in an inconsistent state (i.e. the project.assets.json file was still being updated by VS). Because it should now respond to project changes again, I hope that this class of problem should be resolved.
1 user thanked Remco for this useful post.
eriove on 4/27/2020(UTC)
eriove
#16 Posted : Tuesday, April 28, 2020 7:07:29 AM(UTC)
Rank: Member

Groups: Registered
Joined: 3/22/2016(UTC)
Posts: 20
Location: Sweden

Thanks: 13 times
Was thanked: 2 time(s) in 2 post(s)
While I was traversing the history, checking out commit after commit and rerunning all tests I found what seems to be a similar issue. I was doing the checkouts from the command line this time and I imagine that there are less events for you to listen on from Visual Studio in that case.

Unless you think of an immediate solution for this I wouldn't worry about it. Visual Studio doesn't handle it that particularly well either, so I don't mind NCrunch failing one time in ten as well for this edge case. Just wanted to let you know for completeness sake.

Here's the stack trace (note the difference at the first line, but the similarities after that):
Code:

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:
Unable to find project information for 'C:\xxx\xxx\xxx.csproj'. If you are using Visual Studio, this may be because the project is unloaded or not part of the current solution so run a restore from the command-line. Otherwise, the project file may be invalid or missing targets required for restore.
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)




Other than that it has been working without problems, thanks for excellent support!
Remco
#17 Posted : Tuesday, April 28, 2020 10:57:59 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 787 times
Was thanked: 1023 time(s) in 974 post(s)
Thanks for sharing this information! I would tend to categorise this particular situation as by design, as with the project XML we're totally reliant on VS to feed us with the correct data. For projects that have been loaded into the IDE, we disregard the contents of the file system and instead align ourselves with what VS has in memory. There is huge potential for short term inconsistencies here because VS has several long steps involved in loading a project that has changed on disk (including the restore of packages and generation of project.assets.json). We've tried very hard to make it rock solid, but there's hard limits to what we can do when the IDE doesn't cooperate. I would just recommend hitting the reset button if you end up in an incomplete state after doing checkouts or switching branches.
1 user thanked Remco for this useful post.
eriove on 4/28/2020(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.144 seconds.