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

Notification

Icon
Error

NullReferenceException at nCrunch.Common.IO.DiskPath.DoRebase
spolonski
#1 Posted : Tuesday, January 14, 2025 2:03:11 PM(UTC)
Rank: Advanced Member

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

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

I am using NCrunch in a new solution (.NET 4.8, SDK projects). Unfortunately, I am encountering an exception. See below. Do you have any idea what might be causing this?
NCrunch version is 5.11.0.1

NCrunch: If you are experiencing problems in getting this project to build, have a look at https://www.ncrunch.net/...ng_project-build-issues
NCrunch: This project was built on server '(local)'
NCrunch has encountered an internal error: System.NullReferenceException: Object reference not set to an instance of an object.
at nCrunch.Common.IO.DiskPath.DoRebase(DirectoryPath originalBase, DirectoryPath newBase)
at nCrunch.Compiler.RemoteBuildRunner..()
at nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
at nCrunch.Compiler.RemoteBuildRunner.(ComponentInstrumentationParameters , BuildOutput , IBackgroundTaskProcessor )
at nCrunch.Compiler.RemoteBuildRunner.PerformPostProcessingOfBuiltAssembly(ComponentInstrumentationParameters instrumentationParameters, BuildOutput output, IBackgroundTaskProcessor backgroundTaskProcessor)
at nCrunch.Core.BuildManagement.BuildEnvironment..()
at nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
at nCrunch.Core.BuildManagement.BuildEnvironment.Build(SnapshotComponent snapshotComponentToBuild, IList`1 referencedComponents, GridClientId gridClientId, IList`1 customEnvironmentVariables, IPlatformBuildExtender extender, Guid taskId, GridClientDescription clientDescription, Boolean extractCoverageReportStructure)
Remco
#2 Posted : Tuesday, January 14, 2025 10:56:07 PM(UTC)
Rank: NCrunch Developer

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

Thanks: 966 times
Was thanked: 1298 time(s) in 1203 post(s)
Hi, thanks for sharing this issue.

It looks like there's a file being included in the project that has a weird path, perhaps something over a network?

Would it be possible for you to submit a bug report after this failure? I'm hoping the log file in the report will reveal more information.
spolonski
#3 Posted : Wednesday, January 15, 2025 10:42:14 AM(UTC)
Rank: Advanced Member

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

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

I submitted the bug report with a title "NullReferenceException at nCrunch.Common.IO.DiskPath.DoRebase".

I have not included any files myself in configuration for this solution.
Remco
#4 Posted : Wednesday, January 15, 2025 11:14:11 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 966 times
Was thanked: 1298 time(s) in 1203 post(s)
Thanks for sending through the bug report.

According to the report, the build of your primary project inside the NCrunch workspace is resolving the path of the compiled assembly to a location under your 'Program Files (x86)' directory. This is causing some downstream issues as NCrunch doesn't expect to have compiled outputs stored there, since it's designated as a path to only hold reference assemblies.

Unfortunately the report doesn't contain enough detail to determine what is causing the assembly to land in this place. It doesn't look to me like you have any of your source code there, and I don't see any custom build steps firing in your solution. I think this may be related to one of the packages you're making use of, probably the Sage one. I think it may be doing some kind of redirection of the output path. I don't have access to this package to determine how its build steps work. Since it's installed on your machine, I'd suggest taking a look inside the .targets for the package to see if it does anything like this. There may be a property you can set to override it inside the NCrunch session using the 'Custom build properties' NCrunch configuration setting.

It's important for NCrunch that the build system stores the output assembly inside the NCrunch workspace, otherwise everything will become unstable.
spolonski
#5 Posted : Wednesday, January 15, 2025 11:26:40 AM(UTC)
Rank: Advanced Member

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

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

That helps me. The variable OutDir is currently set in Directory.Build.props without a condition. I will play with a condition property.

<Project>
<PropertyGroup>
<OutDir>c:\Program Files (x86)\Common Files...</OutDir>
</PropertyGroup>
</Project>
Remco
#6 Posted : Wednesday, January 15, 2025 11:28:52 AM(UTC)
Rank: NCrunch Developer

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

Thanks: 966 times
Was thanked: 1298 time(s) in 1203 post(s)
spolonski;17850 wrote:
Thanks Remco,

That helps me. The variable OutDir is currently set in Directory.Build.props without a condition. I will play with a condition property.


Good catch! Try this:

Code:

<Project>
<PropertyGroup Condition="'$(NCrunch)' != '1'">
<OutDir>c:\Program Files (x86)\Common Files...</OutDir>
</PropertyGroup>
</Project>
spolonski
#7 Posted : Wednesday, January 15, 2025 11:33:37 AM(UTC)
Rank: Advanced Member

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

Thanks: 6 times
Was thanked: 5 time(s) in 5 post(s)
Just what the doctor ordered.
1 user thanked spolonski for this useful post.
Remco on 1/15/2025(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.046 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download