Build/Test Issues

NullReferenceException at nCrunch.Common.IO.DiskPath.DoRebase

Started by spolonski on 1,781 views

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/documentation/troubleshooting_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)
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.
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.
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.
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>
spolonski 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:


<Project>
   <PropertyGroup Condition="'$(NCrunch)' != '1'">
      <OutDir>c:\Program Files (x86)\Common Files...</OutDir>
   </PropertyGroup>
</Project>
Just what the doctor ordered.

Post a reply

Log in to reply.