Hello!
I have a solution with 4 projects, on an older laptop they were all building and running tests correctly, having just setup a new one, I'm finding NCrunch will no longer run the tests. The 'library' project doesn't build (get's stuck with the message: 'First time build') and the other projects are just listed as 'Not built'.
The solution compiles in Visual Studio and via pwsh, just not in NCrunch, and R# can run all the tests
I'm on VS 2019 16.10.3
NCrunch 4.8.0.3
I'd normally see the reason for failing to build in the Trace Output, but I'm seeing nothing - and I'm not sure where to look
Any pointers would be greatly appreciated
All the best
Charlotte
Build/Test Issues
Project failing to build - stuck in 'First time build' status
Started by cskardon on 3,304 views
Remco NCrunch Developer
#15502
05 Jul 2021 13:15 UTC
Hi Charlotte,
Thanks for sharing this problem.
Most likely there is a problem occurring under the hood that isn't being reported properly. Would you mind submitting a bug report through the NCrunch menu after you've had this happen to you? The log in the report should help me to analyse the issue on this side.
Thanks for sharing this problem.
Most likely there is a problem occurring under the hood that isn't being reported properly. Would you mind submitting a bug report through the NCrunch menu after you've had this happen to you? The log in the report should help me to analyse the issue on this side.
Hey Remco,
I've done it - let me know if there is something you want me to do to replicate it
I've done it - let me know if there is something you want me to do to replicate it
Remco NCrunch Developer
#15504
06 Jul 2021 00:27 UTC
Thanks Charlotte, I've received the bug report and confirmed the exception below:
System.Exception: System.BadImageFormatException: Could not load file or assembly 'nCrunch.TestRuntime, Version=4.8.0.3, Culture=neutral, PublicKeyToken=01d101bf6f3e0aea' or one of its dependencies. The module was expected to contain an assembly manifest.
File name: 'nCrunch.TestRuntime, Version=4.8.0.3, Culture=neutral, PublicKeyToken=01d101bf6f3e0aea'
at nCrunch.Core.PlatformTypes.DotNetCore.DotNetCorePlatformType.GetCoverageEventListenerTypeForInstrumentation(CilContext context)
at nCrunch.Compiler.NewStaticManipulation.ImportedNCrunchRuntimeAssembly..ctor(CilContext context, CilManipulationOperation manipulationOperation, IBuildPlatformType platformType)
at nCrunch.Compiler.NewStaticManipulation.BuiltCilAssembly..()
at nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
at nCrunch.Compiler.NewStaticManipulation.BuiltCilAssembly.Instrument(IInstrumentationFilter[] instrumentationFilters, PerfTracker perfTracker)
at nCrunch.Compiler.CilProcessingTasks.CilInstrumentationTask.ProcessTask(IBuiltAssembly builtAssembly, ComponentInstrumentationParameters instrumentationParameters, BuildOutput output)
at nCrunch.Compiler.CilProcessingTasks.ConcurrentCilTaskProcessor.()
I've never seen this issue before. nCrunch.TestRuntime is a .NET 3.5 assembly that is shipped with NCrunch, and I can't think of any reason it would fail to load other than the file being corrupt. Could you try reinstalling the version of NCrunch you're using? I'm hoping this will fix the file and allow instrumentation to continue as normal.
System.Exception: System.BadImageFormatException: Could not load file or assembly 'nCrunch.TestRuntime, Version=4.8.0.3, Culture=neutral, PublicKeyToken=01d101bf6f3e0aea' or one of its dependencies. The module was expected to contain an assembly manifest.
File name: 'nCrunch.TestRuntime, Version=4.8.0.3, Culture=neutral, PublicKeyToken=01d101bf6f3e0aea'
at nCrunch.Core.PlatformTypes.DotNetCore.DotNetCorePlatformType.GetCoverageEventListenerTypeForInstrumentation(CilContext context)
at nCrunch.Compiler.NewStaticManipulation.ImportedNCrunchRuntimeAssembly..ctor(CilContext context, CilManipulationOperation manipulationOperation, IBuildPlatformType platformType)
at nCrunch.Compiler.NewStaticManipulation.BuiltCilAssembly..()
at nCrunch.Common.PerformanceTracking.PerfTracker.TrackActivity(String name, Action activity)
at nCrunch.Compiler.NewStaticManipulation.BuiltCilAssembly.Instrument(IInstrumentationFilter[] instrumentationFilters, PerfTracker perfTracker)
at nCrunch.Compiler.CilProcessingTasks.CilInstrumentationTask.ProcessTask(IBuiltAssembly builtAssembly, ComponentInstrumentationParameters instrumentationParameters, BuildOutput output)
at nCrunch.Compiler.CilProcessingTasks.ConcurrentCilTaskProcessor.()
I've never seen this issue before. nCrunch.TestRuntime is a .NET 3.5 assembly that is shipped with NCrunch, and I can't think of any reason it would fail to load other than the file being corrupt. Could you try reinstalling the version of NCrunch you're using? I'm hoping this will fix the file and allow instrumentation to continue as normal.
Hey Remco,
I uninstalled and redownloaded to be sure -
It's all now working as expected! Thank you!
I uninstalled and redownloaded to be sure -
It's all now working as expected! Thank you!
I'm seeing a similar issue, but the exception seems different (peeked into report.zip). Also, only a single (not test) project fails to build. Reinstalling doesn't help. Bug report submitted.
Edited 14 Jul 2021 10:13 UTC
Remco NCrunch Developer
#15524
14 Jul 2021 13:28 UTC
MihaMarkic wrote:I'm seeing a similar issue, but the exception seems different (peeked into report.zip). Also, only a single (not test) project fails to build. Reinstalling doesn't help. Bug report submitted.
Thanks for sending through the bug report. It looks like the NCrunch instrumentation is failing because the assembly it's processing doesn't have a Type Definition table. I haven't seen this before, but I suppose it might be possible to build such an assembly if you're compiling code that doesn't declare any types. Do you have any classes declared in the failing project? If not, does adding a class suppress the issue?
Hi Remco,
It actually has plenty of types and was also building before. The csproj looks like this (below), nothing special except for InternalsVisibleToAttribute (which declares that attribute, but same approach is used in my other projects and it is not new for this project as well).
Any idea what can I try?
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleToAttribute">
<_Parameter1>$(AssemblyName).Test</_Parameter1>
<!-- We use the value of AssemblyName to declare the value of the attribute -->
</AssemblyAttribute>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="5.0.0" />
</ItemGroup>
</Project>
It actually has plenty of types and was also building before. The csproj looks like this (below), nothing special except for InternalsVisibleToAttribute (which declares that attribute, but same approach is used in my other projects and it is not new for this project as well).
Any idea what can I try?
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleToAttribute">
<_Parameter1>$(AssemblyName).Test</_Parameter1>
<!-- We use the value of AssemblyName to declare the value of the attribute -->
</AssemblyAttribute>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="5.0.0" />
</ItemGroup>
</Project>
Remco NCrunch Developer
#15527
15 Jul 2021 13:25 UTC
Is there any chance you can build a code sample that can reproduce the issue which you can share with me? Something is unusual about the structure of the DLL being built here. I wonder if that AssemblyAttribute might have something to do with it.
Hm, not sure what or when it happened, but the project is building again and tests are running. Before that I've tried to isolate the problematic project, but it worked in a new solution.
Basically it's fine now and I can't reproduce it anymore. Hopefully it won't reappear.
Basically it's fine now and I can't reproduce it anymore. Hopefully it won't reappear.
Remco NCrunch Developer
#15539
17 Jul 2021 01:44 UTC
MihaMarkic wrote:Hm, not sure what or when it happened, but the project is building again and tests are running. Before that I've tried to isolate the problematic project, but it worked in a new solution.
Basically it's fine now and I can't reproduce it anymore. Hopefully it won't reappear.
Thanks for letting me know. If you manage to reproduce it somewhere down the line, I'd like to dig a bit deeper. Probably this is not the last we'll see of this problem.
Post a reply
Log in to reply.