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



VS 2022 Preview + FSharp = Boom
#1 Posted : Thursday, July 15, 2021 11:01:37 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 7/15/2021(UTC)
Posts: 2
Location: United States of America

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
I just installed the 2022 Preview today and NCrunch.

VS details as follows:

Microsoft Visual Studio Community 2022 Preview
Version 17.0.0 Preview 2.0
Microsoft .NET Framework
Version 4.8.04084

NCrunch version is

Creating a brand new F# xUnit test project yields the following "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 "FSharpEmbedResXSource" task could not be loaded from the assembly C:\Program Files\dotnet\sdk\6.0.100-preview.6.21355.2\FSharp\FSharp.Build.dll. A BadImageFormatException has been thrown while parsing the signature. This is likely due to lack of a generic context. Ensure genericTypeArguments and genericMethodArguments are provided and contain enough context. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.
   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 targetFrameworkForMsbuild, String visibleTargetFramework)

NCrunch normally works for F# projects in VS 2019 :)
#2 Posted : Friday, July 16, 2021 12:32:54 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 839 times
Was thanked: 1140 time(s) in 1064 post(s)
Congrats on finding our first VS2022 explosion!! :)

Can you confirm that the project builds correctly under VS2022? (Sorry, I know this is probably implied, but the nature of this error looks very toolset-y).

Edit: Something else to check would be whether changing your build process CPU architecture resolves the issue. We might still be running under x86 by default here.
1 user thanked Remco for this useful post.
dharmaturtle on 7/16/2021(UTC)
#3 Posted : Friday, July 16, 2021 11:19:38 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 7/15/2021(UTC)
Posts: 2
Location: United States of America

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
Thaaaaat was it! It was set to x86, and changing it to x64 made it work. Thanks!

I'm not sure how to mark this thread as resolved, but please consider it as such.
1 user thanked dharmaturtle for this useful post.
Remco on 7/17/2021(UTC)
Users browsing this topic
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.149 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download