Build/Test Issues

WPF projects don't compile anymore when dotnet7 is installed

Started by DeltaEngine on 2,859 views

Hi Remco,

Even with the latest NCrunch release (4.14.0.7) we still have the issue on ANY WPF project (.NET6 or .NET7, doesn't matter) that NCrunch build throws an error:

C:\Program Files\dotnet\sdk\7.0.100-preview.6.22352.1\Sdks\Microsoft.NET.Sdk.WindowsDesktop\targets\Microsoft.WinFX.targets (211): Unknown build error, 'Method 'GetGenericInstantiation' in type 'System.Reflection.TypeLoading.Ecma.EcmaModule' from assembly 'System.Reflection.MetadataLoadContext, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' does not have an implementation.'

The "fix" is to add a global.json file in the project folder to switch dotnet back to version 6.0.400:
{
"sdk": {
"version": "6.0.400",
"rollForward": "latestFeature"
}
}

Now WPF and Ncrunch are happy for .NET6 project, but obviously no .NET7 projects can be compiled anymore when switching the dotnet tool to .NET6.

Not sure if this has anything to do with NCrunch (probably some issue with dotnet command line tool), but all other things (dotnet build, test, etc. console stuff, Visual Studio, ReSharper) all work fine with .NET7 and WPF projects.

Thanks
Hi, thanks for sharing this issue.

Right now we don't have any support for NET7. It's still too early for us to handle this one. We'll be performing more QA and troubleshooting on this one closer to its release date.
Hi!

we've had a look at the net7 release candidate and the problem you reported persists. We've create a new build to address this problem. If you're interested you can try this build below:

NCrunch_Console_4.15.0.1.msi
NCrunch_Console_4.15.0.1.zip
NCrunch_GridNodeServer_4.15.0.1.msi
NCrunch_GridNodeServer_4.15.0.1.zip
NCrunch_LicenseServer_4.15.0.1.zip
NCrunch_VS2010_4.15.0.1.msi
NCrunch_VS2010_4.15.0.1.zip
NCrunch_VS2012_4.15.0.1.msi
NCrunch_VS2012_4.15.0.1.zip
NCrunch_VS2013_4.15.0.1.msi
NCrunch_VS2013_4.15.0.1.zip
NCrunch_VS2015_4.15.0.1.msi
NCrunch_VS2015_4.15.0.1.msi.7z
NCrunch_VS2015_4.15.0.1.zip
NCrunch_VS2017_4.15.0.1.msi
NCrunch_VS2017_4.15.0.1.msi.7z
NCrunch_VS2017_4.15.0.1.zip
NCrunch_VS2019_4.15.0.1.msi
NCrunch_VS2019_4.15.0.1.msi.7z
NCrunch_VS2019_4.15.0.1.zip
NCrunch_VS2022_4.15.0.1.msi
NCrunch_VS2022_4.15.0.1.msi.7z
NCrunch_VS2022_4.15.0.1.zip
Thanks for the update and build that fixes the issue, works perfect in our big solutions, now we can fully switch to .net 7.
Thanks michaelkroes for your kind reply, so far the main problem that related to WPF has been solved with this shared build,

but we get a new problem and this stopped Ncrunch to work correctly, please check the below error, even though our projects use .net 7 on machines that have .net7 SDKs

we tried several solution even we reinstalled everything from scratch but the problem doesn't solve





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 current .NET SDK does not support targeting .NET 7.0. Either target .NET 6.0 or lower, or use a version of the .NET SDK that supports .NET 7.0.
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.RemoteProxyCommunicator. (Byte[] )
at nCrunch.TaskRunner.Ipc.RemoteProxyCommunicator.Invoke(String methodName, Object[] args)
at nCrunch.Compiler.RemoteBuildRunnerProxy.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 , DotNetCoreSdkVersion )
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, IDEVersion vsVersion, ComponentUniqueName componentName, TaskSettings componentTaskSettings, Exception parseException, String targetFrameworkForMsbuild, String visibleTargetFramework)
Hi, sorry to hear there's another issue here.

Is this something you can reproduce with a sample project that you can share with us? Right now we don't know how to produce this problem.
unfortunately, it is unexpected behavior, and doesn't happen on all PCs,

but using global.json file solve this problem in some cases
Is it possible the machines are running different versions of the NET7 SDK?

Are these machines able to run any kind of NET7 application? i.e. if you build a console app referencing a NET7 project, does it run?
Thanks for your reply, these machines have already .Net7, we tried with a simple class library project but the problem same.

We decide later to do clean windows OS installation for these machines, and the problem is gone, is there any cache/ Registry record files need to consider when we remove Ncrunch from Machine?
egilgamesh wrote:
We decide later to do clean windows OS installation for these machines, and the problem is gone, is there any cache/ Registry record files need to consider when we remove Ncrunch from Machine?


The NCrunch uninstaller should take care of anything relevant here.

I suspect this issue may be down to the install state of a preview platform. Glad to hear you've resolved the issue. Nice work!

Post a reply

Log in to reply.