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

Notification

Icon
Error

Unable to build apps with "older" Windows SDK
MatthewSteeples
#1 Posted : Wednesday, November 20, 2024 11:17:59 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 10/28/2014(UTC)
Posts: 142
Location: United Kingdom

Thanks: 7 times
Was thanked: 19 time(s) in 17 post(s)
Project built fine in NCrunch with VS 17.11

17.12 removed version 17763 of the Windows SDK by default but as we're still targeting it we've downloaded it from Microsoft and installed it. Visual Studio picks it up fine, but NCrunch gives the following exception. Will submit feedback in the app with the URL of this thread. Happy to provide a simple repro project if that helps.

Code:

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: The NCrunch task process failed to correctly initialise with the following exception: nCrunch.TaskRunner.Ipc.IpcConnectionClosedException: The NCrunch task process was unexpectedly terminated.  For information on how to troubleshoot this problem, please see https://www.ncrunch.net/documentation/troubleshooting_process-terminated-unexpected-error
   at nCrunch.TaskRunner.Ipc.Fast.IpcReader.Initialise()
   at nCrunch.TaskRunner.Ipc.Fast.IpcStream.Connect()
   at nCrunch.TaskRunner.Ipc.Fast.FastIpcClient.Connect()
   at nCrunch.Core.ProcessManagement.DefaultProcessLoader.ConnectToProcess(ExternalProcess externalProcess, ProcessLoadParameters parameters, Action`1 outOfBandMessageHandler)
   at nCrunch.Core.ProcessManagement.ExternalProcessManager..()
   at nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
   at nCrunch.Core.ProcessManagement.ExternalProcessManager.(EffectiveProcessorArchitecture , ProcessLoadParameters , Boolean )

The trace output for the process is as follows: 
You must install or update .NET to run this application.

App: Q:\NCrunch\Workspace\18324\1\LedgerscopeSolution\Ledgerscope.Extractor.Movemybooks.Checks\bin\Debug\net8.0-windows10.0.17763.0\nCrunch.TaskRunner.DotNetCore.20.x64.dll
Architecture: x64
Framework: 'Microsoft.Windows.SDK.NET.Ref.Windows', version '10.0.17763.54' (x64)
.NET location: C:\Program Files\dotnet\

No frameworks were found.

Learn more:
https://aka.ms/dotnet/app-launch-failed

To install missing framework, download:
https://aka.ms/dotnet-core-applaunch?framework=Microsoft.Windows.SDK.NET.Ref.Windows&framework_version=10.0.17763.54&arch=x64&rid=win-x64&os=win10

Remco
#2 Posted : Wednesday, November 20, 2024 11:47:39 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,150

Thanks: 961 times
Was thanked: 1294 time(s) in 1200 post(s)
Hi, thanks for sharing this issue.

The first thing I'd suggest checking here is whether the SDK installations on your machine are exactly the same as what you are targeting.

VS has a LOT of implicit behaviour in resolving SDKs, and I've found many occasions in the past where it's quietly served up something different when things go wrong. NCrunch tends to be a bit more sensitive to issues because it feeds versions directly into the loader.

Check that the installation directories contain the files you would expect to find there. Sometimes the installers/uninstallers can quietly fail and leave behind empty directories that can mess with the resolution and give weird errors. This can cause problems even if the empty directories contain versions different to the one you are targeting.

Finally, make sure you are actually able to build and run a .NET 10.0.17763.54 x64 .EXE application on your machine directly without NCrunch or Visual Studio involved. Often taking the tools out of the mix and going directly down to the platform can help narrow the problem down faster.
MatthewSteeples
#3 Posted : Thursday, November 21, 2024 10:55:28 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 10/28/2014(UTC)
Posts: 142
Location: United Kingdom

Thanks: 7 times
Was thanked: 19 time(s) in 17 post(s)
I'll lay out what I've tested and experienced and see if that answers any of your questions:

* Project built fine in VS 17.11 and NCrunch with the Windows SDK installed through VS
* VS 17.12 installed, project no longer builds in VS or NCrunch (because SDK is not present)
* Windows SDK installed, project now builds in VS but not in NCrunch

Additionally

* I can build the project from the command line using msbuild
* I can't build it using dotnet because it contains Com References and they're still not supported
* I've got a Binlog of that which I'm happy to share if that helps
* I've tried to get NCrunch to output a Binlog too (by setting the MSBuildDebugEngine environment variable to 1) but it looks like it's crashing before even attempting to build this project, as Binlogs are only generated for some dependencies
Remco
#4 Posted : Thursday, November 21, 2024 10:59:32 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,150

Thanks: 961 times
Was thanked: 1294 time(s) in 1200 post(s)
Can you confirm whether you are able to build a .NET 10.0.17763.54 x64 console project .DLL and run this on your machine using dotnet.exe?
MatthewSteeples
#6 Posted : Thursday, November 21, 2024 11:00:49 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 10/28/2014(UTC)
Posts: 142
Location: United Kingdom

Thanks: 7 times
Was thanked: 19 time(s) in 17 post(s)
Will do shortly. I've just found the binlogs that NCrunch output (they were in the project folder rather than the workspace folder which is why I'd missed them initially) so I'm just having a skim through to see if there's anything leaping out
MatthewSteeples
#5 Posted : Thursday, November 21, 2024 11:15:13 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 10/28/2014(UTC)
Posts: 142
Location: United Kingdom

Thanks: 7 times
Was thanked: 19 time(s) in 17 post(s)
Remco;17750 wrote:
Can you confirm whether you are able to build a .NET 10.0.17763.54 x64 console project .DLL and run this on your machine using dotnet.exe?


Hmm, both dotnet _and_ NCrunch successfully build a console project targeting net8.0-windows10.0.17763.0 so there must be something else that it's not happy with
Remco
#7 Posted : Thursday, November 21, 2024 11:28:25 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,150

Thanks: 961 times
Was thanked: 1294 time(s) in 1200 post(s)
Check the contents of the .runtimeconfig.json file that is adjacent to the DLL of the test project (or console project). This contains the version of the platform that should be targeted by the loader. Maybe something is going wrong in how that version is specified.

Random thought: x64/x86 issues can cause this problem because if the project is set to target the x86 SDK, it won't be looking in the standard x64 install paths for the platform SDK.
MatthewSteeples
#8 Posted : Thursday, November 21, 2024 11:56:28 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 10/28/2014(UTC)
Posts: 142
Location: United Kingdom

Thanks: 7 times
Was thanked: 19 time(s) in 17 post(s)
runtimeconfig.json file is identical across all 4 locations

* Test project bin folder
* NCrunch workspace for test project
* Regular project bin folder
* Regular project NCrunch workspace

Code:
{
  "runtimeOptions": {
    "tfm": "net8.0",
    "framework": {
      "name": "Microsoft.NETCore.App",
      "version": "8.0.0"
    },
    "configProperties": {
      "System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false,
      "CSWINRT_USE_WINDOWS_UI_XAML_PROJECTIONS": false
    }
  }
}


The SDK is listed in the deps.json file

The x86/x64 might be related, although I've tried setting up the test project with the same build architectures as the regular project. It targets x86 because of COM. I believe the SDK is installed for both.
Remco
#9 Posted : Friday, November 22, 2024 2:05:05 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,150

Thanks: 961 times
Was thanked: 1294 time(s) in 1200 post(s)
Could you also check nCrunch.TaskRunner.DotNetCore.20.x64.runtimeconfig.json?

Note that the x86 version of dotnet is a whole separate thing to x64. It's installed in a different path, and has its own SDKs. Sometimes tooling can get confused between the two instances and it won't find the SDKs that are installed because they are not in the expected path. I'm not certain if this is affecting you but thought I would raise it, since it's been a source of gotchas in the past.
MatthewSteeples
#10 Posted : Sunday, November 24, 2024 11:42:50 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 10/28/2014(UTC)
Posts: 142
Location: United Kingdom

Thanks: 7 times
Was thanked: 19 time(s) in 17 post(s)
So the reason my sample project built is that it had no tests in it. Looks like the problem isn't with the building, but with the environment for executing of tests. On the plus side, this means I can give you a super minimal repro.

The relevant lines in the logs appears to be the following

Code:
[PID:27416 22:37:16.469 ?-214] Process 25572: --- The specified framework 'Microsoft.Windows.SDK.NET.Ref.Windows', version '10.0.17763.54', apply_patches=1, version_compatibility_range=minor is compatible with the previously referenced version '10.0.17763.54'.
[PID:27416 22:37:16.469 ?-214] Process 25572: --- Resolving FX directory, name 'Microsoft.Windows.SDK.NET.Ref.Windows' version '10.0.17763.54'
[PID:27416 22:37:16.469 ?-214] Process 25572: Searching FX directory in [C:\Program Files\dotnet]
[PID:27416 22:37:16.469 LocalBuildTask-207] Writing new workspace member Q:\NCrunchWorkspace\27416\124\LedgerscopeSolution\Ledgerscope.Core\Models\Pocos\TableInfos.cs (version 1)
[PID:27416 22:37:16.469 ?-214] Process 25572: Attempting FX roll forward starting from version='[10.0.17763.54]', apply_patches=1, version_compatibility_range=minor, roll_to_highest_version=0, prefer_release=1
[PID:27416 22:37:16.469 ?-214] Process 25572: 'Roll forward' enabled with version_compatibility_range [minor]. Looking for the lowest release greater than or equal version to [10.0.17763.54]
[PID:27416 22:37:16.469 ?-214] Process 25572: No match greater than or equal to [10.0.17763.54] found.
[PID:27416 22:37:16.469 ?-214] Process 25572: 'Roll forward' enabled with version_compatibility_range [minor]. Looking for the lowest release/pre-release greater than or equal version to [10.0.17763.54]
[PID:27416 22:37:16.469 ?-214] Process 25572: No match greater than or equal to [10.0.17763.54] found.
[PID:27416 22:37:16.469 ?-214] Process 25572: Framework reference didn't resolve to any available version.
[PID:27416 22:37:16.469 ?-214] Process 25572: It was not possible to find any compatible framework version
[PID:27416 22:37:16.469 ?-214] Process 25572: You must install or update .NET to run this application.


Repro can be found here: https://github.com/matthewsteeples/ncrunch17763
SDK to install can be found here: https://go.microsoft.com...link/p/?LinkID=2033908. You only need to tick three things to get it to build in VS (probably less, but we only have three ticked)
  • MSI Tools
  • Windows SDK Signing Tools for Desktop Apps
  • Windows SDK for UWP Managed Apps
MatthewSteeples
#11 Posted : Sunday, November 24, 2024 11:44:00 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 10/28/2014(UTC)
Posts: 142
Location: United Kingdom

Thanks: 7 times
Was thanked: 19 time(s) in 17 post(s)
Also, it appears the x86/x64 was a red herring. The repro I've provided is AnyCPU
Remco
#12 Posted : Monday, November 25, 2024 3:50:57 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,150

Thanks: 961 times
Was thanked: 1294 time(s) in 1200 post(s)
1 user thanked Remco for this useful post.
bitrocks on 11/29/2024(UTC)
MatthewSteeples
#13 Posted : Monday, November 25, 2024 12:00:35 PM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 10/28/2014(UTC)
Posts: 142
Location: United Kingdom

Thanks: 7 times
Was thanked: 19 time(s) in 17 post(s)
Remco;17770 wrote:
Would you be interested in trying the build below to see if this solves the problem for you?


Looks to work great, thanks
1 user thanked MatthewSteeples for this useful post.
Remco on 11/25/2024(UTC)
erwinvandervalk
#14 Posted : Thursday, December 5, 2024 10:30:09 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 12/23/2019(UTC)
Posts: 6
Location: Netherlands

Was thanked: 2 time(s) in 2 post(s)
I'm also running into this error, but for me the new version isn't solving it.

For what it's worth.. I did a completely fresh install of windows 11, installed visual studio, installed .net 8 sdk, installed latest version of ncrunch (and later also the version in this post) and then create a brand new xunit test project. It runs and builds fine... but doesn't compile in ncrunch.

Quote:

NCrunch was unable to resolve dependency data for its own assemblies under your chosen framework. It is possible that the version of NCrunch you are using does not have support for this framework, or otherwise there may be another problem present on your system. NCrunch will fall back to using pre-packaged dependency data which may or may not be compatible with your chosen framework. This may result in dependency resolution problems inside your test environments.

Details for this problem are below:

The msbuild command returned exit code 1: "c:\program files\microsoft visual studio\2022\community\MSBuild\Current\Bin\msbuild.exe" /t:Restore nCrunch.Module.XUnit2.DotNetCore.csproj



Click here to hide this warning


and

Quote:

NCrunch was unable to restore Nuget packages required to build a test environment for this solution, due to an error: The msbuild command returned exit code 1: "c:\program files\microsoft visual studio\2022\community\MSBuild\Current\Bin\msbuild.exe" /t:Restore "C:\Users\erwin\AppData\Local\NCrunch\33964\PackageRestore\restorePackages.csproj"

The following packages do not exist under the Nuget packages folder for the active user profile, yet they have been flagged by NCrunch as potentially needed for normal operation. NCrunch has attempted to restore these files via an MSBuild restore step, which has either failed or not returned the expected result. It's possible that these packages may not be needed for building projects or running tests in your environment. If you experience downstream problems with NCrunch on this solution, it is recommended you restore or download the packages manually.

Note that the restore of packages may fail if NCrunch is being hosted under a windows account that does not have sufficient rights to store files in the Nuget packages directory.Microsoft.Win32.Primitives v4.3.0
NETStandard.Library v1.6.1
runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl v4.3.0
runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl v4.3.0
runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl v4.3.0
runtime.native.System v4.3.0
runtime.native.System.IO.Compression v4.3.0
runtime.native.System.Net.Http v4.3.0
runtime.native.System.Security.Cryptography.Apple v4.3.0
runtime.native.System.Security.Cryptography.OpenSsl v4.3.0
runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl v4.3.0
runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl v4.3.0
runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple v4.3.0
runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl v4.3.0
runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl v4.3.0
runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl v4.3.0
runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl v4.3.0
runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl v4.3.0
System.AppContext v4.3.0
System.Buffers v4.3.0
System.Collections.NonGeneric v4.3.0
System.Console v4.3.0
System.Diagnostics.DiagnosticSource v4.3.0
System.Diagnostics.TraceSource v4.3.0
System.Globalization.Calendars v4.3.0
System.Globalization.Extensions v4.3.0
System.IO.Compression v4.3.0
System.IO.Compression.ZipFile v4.3.0
System.Net.Http v4.3.0
System.Net.Primitives v4.3.0
System.Net.Sockets v4.3.0
System.Runtime.InteropServices.RuntimeInformation v4.3.0
System.Runtime.Loader v4.3.0
System.Runtime.Numerics v4.3.0
System.Runtime.Serialization.Formatters v4.3.0
System.Security.Cryptography.Algorithms v4.3.0
System.Security.Cryptography.Cng v4.3.0
System.Security.Cryptography.Csp v4.3.0
System.Security.Cryptography.Encoding v4.3.0
System.Security.Cryptography.OpenSsl v4.3.0
System.Security.Cryptography.Primitives v4.3.0
System.Security.Cryptography.X509Certificates v4.3.0
System.Threading.Thread v4.3.0
System.Threading.Timer v4.3.0
System.Collections.NonGeneric v4.3.0
System.Runtime.Loader v4.3.0
System.Runtime.Serialization.Formatters v4.3.0
System.Threading.Thread v4.3.0
System.Collections.NonGeneric v4.3.0
System.Runtime.Loader v4.3.0
System.Runtime.Serialization.Formatters v4.3.0
System.Threading.Thread v4.3.0
Microsoft.Win32.Primitives v4.3.0
NETStandard.Library v1.6.1
runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl v4.3.0
runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl v4.3.0
runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl v4.3.0
runtime.native.System v4.3.0
runtime.native.System.IO.Compression v4.3.0
runtime.native.System.Net.Http v4.3.0
runtime.native.System.Security.Cryptography.Apple v4.3.0
runtime.native.System.Security.Cryptography.OpenSsl v4.3.0
.... snip

Remco
#15 Posted : Thursday, December 5, 2024 11:03:11 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,150

Thanks: 961 times
Was thanked: 1294 time(s) in 1200 post(s)
Thanks for posting. Could you show the exact compile error you're seeing? The error at the top of this thread is a runtime environment error. The warning you've posted can be a red herring if you have the correct nuget packages installed. Note that you can work around the problem described by the warning by creating your own dummy project referencing the missing packages, as this will force the IDE to restore them.
erwinvandervalk
#16 Posted : Thursday, December 5, 2024 12:23:39 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 12/23/2019(UTC)
Posts: 6
Location: Netherlands

Was thanked: 2 time(s) in 2 post(s)
Here's the error I got.
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: The NCrunch task process failed to correctly initialise with the following exception: nCrunch.TaskRunner.Ipc.IpcConnectionClosedException: The NCrunch task process was unexpectedly terminated. For information on how to troubleshoot this problem, please see https://www.ncrunch.net/...inated-unexpected-error
at nCrunch.TaskRunner.Ipc.Fast.IpcReader.Initialise()
at nCrunch.TaskRunner.Ipc.Fast.IpcStream.Connect()
at nCrunch.TaskRunner.Ipc.Fast.FastIpcClient.Connect()
at nCrunch.Core.ProcessManagement.DefaultProcessLoader.ConnectToProcess(ExternalProcess externalProcess, ProcessLoadParameters parameters, Action`1 outOfBandMessageHandler)
at nCrunch.Core.ProcessManagement.ExternalProcessManager..()
at nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
at nCrunch.Core.ProcessManagement.ExternalProcessManager.(EffectiveProcessorArchitecture , ProcessLoadParameters , Boolean )

The trace output for the process is as follows:
Error:
An assembly specified in the application dependencies manifest (nCrunch.TaskRunner.DotNetCore.20.x64.deps.json) was not found:
package: 'System.Collections.NonGeneric', version: '4.3.0'
path: 'lib/netstandard1.3/System.Collections.NonGeneric.dll'

Remco
#17 Posted : Thursday, December 5, 2024 10:24:07 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,150

Thanks: 961 times
Was thanked: 1294 time(s) in 1200 post(s)
Could you try creating a small dummy project in VS, with a reference to System.Collections.NonGeneric v4.3.0? This will force Nuget to restore the package and should get you up and running.
erwinvandervalk
#18 Posted : Friday, December 6, 2024 1:01:45 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 12/23/2019(UTC)
Posts: 6
Location: Netherlands

Was thanked: 2 time(s) in 2 post(s)
I found the issue and it was a weird one.

Somehow, after re-installing my machine and re-installing visual studio etc.. I did not have any nuget feeds. But.. compiling / running in visual studio 'just worked'.

So, the error that it couldn't restore packages was correct. It's just weird that somehow visual studio's build could compensate for it.

Anyway, thanks for your help and keep up the great work with NCrunch. Can't work without it anymore.
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.121 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download