Build/Test Issues

NCrunch fails to build (and then test)

Started by Dirk Maegh on 1,871 views

Hi,

I just opened this repo https://github.com/andrewlock/NetEscapades.EnumGenerators/
And then the solution NetEscapades.EnumGenerators.sln.

Building runs fine in VS2022 (latest version, Windows 11)
I do not have all .Net frameworks installed, and am only interested in .Net 6 and 7, and NetStandard. I would like to create source generators for myself.

Opening test explorer sees a lot of tests, I ran the following for .Net 6 and .Net 7. without problems
NetEscapades.EnumGenerators.IntegrationTests
NetEscapades.EnumGenerators.NetStandard.IntegrationTests
NetEscapades.EnumGenerators.Tests

But NCrunch 4.16.01 seems to have some trouble building. (and I had to reload a lot of the projects to make them build)

The project NetEscapades.EnumGenerators.NetStandard shows following NCrunch logs
..\NetEscapades.EnumGenerators.IntegrationTests\Enums.cs (62, 6): The type or namespace name 'EnumExtensionsAttribute' could not be found (are you missing a using directive or an assembly reference?)
..\NetEscapades.EnumGenerators.IntegrationTests\Enums.cs (62, 6): The type or namespace name 'EnumExtensions' could not be found (are you missing a using directive or an assembly reference?)
..\NetEscapades.EnumGenerators.IntegrationTests\Enums.cs (20, 6): The type or namespace name 'EnumExtensionsAttribute' could not be found (are you missing a using directive or an assembly reference?)
..\NetEscapades.EnumGenerators.IntegrationTests\Enums.cs (20, 6): The type or namespace name 'EnumExtensions' could not be found (are you missing a using directive or an assembly reference?)
..\NetEscapades.EnumGenerators.IntegrationTests\Enums.cs (50, 6): The type or namespace name 'EnumExtensionsAttribute' could not be found (are you missing a using directive or an assembly reference?)
..\NetEscapades.EnumGenerators.IntegrationTests\Enums.cs (28, 6): The type or namespace name 'EnumExtensionsAttribute' could not be found (are you missing a using directive or an assembly reference?)
..\NetEscapades.EnumGenerators.IntegrationTests\Enums.cs (50, 6): The type or namespace name 'EnumExtensions' could not be found (are you missing a using directive or an assembly reference?)
..\NetEscapades.EnumGenerators.IntegrationTests\Enums.cs (28, 6): The type or namespace name 'EnumExtensions' could not be found (are you missing a using directive or an assembly reference?)
..\NetEscapades.EnumGenerators.IntegrationTests\Enums.cs (39, 6): The type or namespace name 'EnumExtensionsAttribute' could not be found (are you missing a using directive or an assembly reference?)
..\NetEscapades.EnumGenerators.IntegrationTests\Enums.cs (39, 6): The type or namespace name 'EnumExtensions' could not be found (are you missing a using directive or an assembly reference?)
..\NetEscapades.EnumGenerators.IntegrationTests\Enums.cs (9, 6): The type or namespace name 'EnumExtensionsAttribute' could not be found (are you missing a using directive or an assembly reference?)
..\NetEscapades.EnumGenerators.IntegrationTests\Enums.cs (9, 6): The type or namespace name 'EnumExtensions' could not be found (are you missing a using directive or an assembly reference?)
..\NetEscapades.EnumGenerators.IntegrationTests\Enums.cs (70, 6): The type or namespace name 'EnumExtensionsAttribute' could not be found (are you missing a using directive or an assembly reference?)
..\NetEscapades.EnumGenerators.IntegrationTests\Enums.cs (70, 6): The type or namespace name 'EnumExtensions' could not be found (are you missing a using directive or an assembly reference?)

There are more problems, but this one probably is the most pressing ?

Thx for looking into this one :)

Dirk
Thanks for sharing this issue. Could you try the build below and let me know if this solves the issue? This contains a fix we recently introduced for source generator references. I think this is worth trying before we delve in to take a deeper look.

NCrunch_Console_4.17.0.3.msi
NCrunch_Console_4.17.0.3.zip
NCrunch_GridNodeServer_4.17.0.3.msi
NCrunch_GridNodeServer_4.17.0.3.zip
NCrunch_LicenseServer_4.17.0.3.zip
NCrunch_VS2010_4.17.0.3.msi
NCrunch_VS2010_4.17.0.3.zip
NCrunch_VS2012_4.17.0.3.msi
NCrunch_VS2012_4.17.0.3.zip
NCrunch_VS2013_4.17.0.3.msi
NCrunch_VS2013_4.17.0.3.zip
NCrunch_VS2015_4.17.0.3.msi
NCrunch_VS2015_4.17.0.3.msi.7z
NCrunch_VS2015_4.17.0.3.zip
NCrunch_VS2017_4.17.0.3.msi
NCrunch_VS2017_4.17.0.3.msi.7z
NCrunch_VS2017_4.17.0.3.zip
NCrunch_VS2019_4.17.0.3.msi
NCrunch_VS2019_4.17.0.3.msi.7z
NCrunch_VS2019_4.17.0.3.zip
NCrunch_VS2022_4.17.0.3.msi
NCrunch_VS2022_4.17.0.3.msi.7z
NCrunch_VS2022_4.17.0.3.zip
Thanks for letting me try your new build.
It indeed solves most of the issues.

After I configured NCrunch to completely ignore all dotnet frameworks I hadn't installed, it resolved all builds and tests, except for the one project _build.
It does not compile in NCrunch.

<Quote>
NCrunch: If you are experiencing problems in getting this project to build, have a look at http://www.ncrunch.net/documentation/troubleshooting_project-build-issues
CSC (0, 0): Generator 'StronglyTypedSolutionGenerator' failed to generate source. It will not contribute to the output and compilation errors may occur as a result. Exception was of type 'FileNotFoundException' with message 'Could not find file 'C:\Users\DirkMaegh\AppData\Local\NCrunch\4400\18\NetEscapades.EnumGenerators.sln'.'
Build.cs (122, 26): 'Solution' does not contain a definition for 'tests' and no accessible extension method 'tests' accepting a first argument of type 'Solution' could be found (are you missing a using directive or an assembly reference?)
Build.cs (123, 26): 'Solution' does not contain a definition for 'tests' and no accessible extension method 'tests' accepting a first argument of type 'Solution' could be found (are you missing a using directive or an assembly reference?)
</Quote>

In VS2022, it gives me following output
<Quote>
Rebuild started...
Restored C:\Projects\NetEscapades.EnumGenerators\src\NetEscapades.EnumGenerators\NetEscapades.EnumGenerators.csproj (in 22 ms).
Restored C:\Projects\NetEscapades.EnumGenerators\src\NetEscapades.EnumGenerators.Attributes\NetEscapades.EnumGenerators.Attributes.csproj (in 15 ms).
Restored C:\Projects\NetEscapades.EnumGenerators\samples\ToStringFastExample\ToStringFastExample.csproj (in 172 ms).
1>------ Rebuild All started: Project: _build, Configuration: Debug Any CPU ------
Restored C:\Projects\NetEscapades.EnumGenerators\build\_build.csproj (in 267 ms).
Restored C:\Projects\NetEscapades.EnumGenerators\tests\NetEscapades.EnumGenerators.NetStandard\NetEscapades.EnumGenerators.NetStandard.csproj (in 4 ms).
Restored C:\Projects\NetEscapades.EnumGenerators\tests\NetEscapades.EnumGenerators.Benchmarks\NetEscapades.EnumGenerators.Benchmarks.csproj (in 380 ms).
Restored C:\Projects\NetEscapades.EnumGenerators\tests\NetEscapades.EnumGenerators.Nuget.IntegrationTests\NetEscapades.EnumGenerators.Nuget.IntegrationTests.csproj (in 427 ms).
Restored C:\Projects\NetEscapades.EnumGenerators\tests\NetEscapades.EnumGenerators.Nuget.Attributes.IntegrationTests\NetEscapades.EnumGenerators.Nuget.Attributes.IntegrationTests.csproj (in 426 ms).
Restored C:\Projects\NetEscapades.EnumGenerators\tests\NetEscapades.EnumGenerators.Tests\NetEscapades.EnumGenerators.Tests.csproj (in 425 ms).
Restored C:\Projects\NetEscapades.EnumGenerators\tests\NetEscapades.EnumGenerators.NetStandard.IntegrationTests\NetEscapades.EnumGenerators.NetStandard.IntegrationTests.csproj (in 424 ms).
Restored C:\Projects\NetEscapades.EnumGenerators\tests\NetEscapades.EnumGenerators.IntegrationTests\NetEscapades.EnumGenerators.IntegrationTests.csproj (in 290 ms).
1>_build -> C:\Projects\NetEscapades.EnumGenerators\build\bin\Debug\_build.dll
========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========
========== Rebuild started at 7:31 AM and took 00,991 seconds ==========
</Quote>
Great to hear we are getting closer on this one :)

I suspect this issue may be caused by a dependency on a solution file that isn't in the NCrunch workspace. Does adding the .sln file to your NCrunch 'Additional files to include' setting resolve the issue?
Yes it does :)
But that is certainly not intuitive.

Thx for your assistance.

Post a reply

Log in to reply.