Missing Burst safeguards ENABLE_UNITY_ COLLECTIONS_CHECKS

When building a Unity project that includes the A* Pathfinding Project using the Burst compiler, the following message is spammed:

/path/to/project/Library/PackageCache/com.unity.burst@1.5.3/.Runtime/bcl.exe exited after 4397 ms.
An exception was thrown from a function without the correct [Conditional("ENABLE_UNITY_COLLECTIONS_CHECKS")] guard. Exceptions only work in the editor and so should be only thrown in a function protected by this guard
 at Pathfinding.Voxels.Burst.CompactVoxelField.BuildFromLinkedField(Pathfinding.Voxels.Burst.CompactVoxelField* this, Pathfinding.Voxels.Burst.LinkedVoxelField* field) (at /path/to/project/Packages/com.arongranberg.astar@4.3.43/Generators/Utilities/Voxels/CompactVoxelFieldBurst.cs:56)
 at Pathfinding.Voxels.Burst.JobBuildCompactField.Execute(Pathfinding.Voxels.Burst.JobBuildCompactField* this) (at /path/to/project/Packages/com.arongranberg.astar@4.3.43/Generators/Utilities/Voxels/VoxelRasterizationBurst.cs:266)
 at Unity.Jobs.IJobExtensions.JobStruct`1<Pathfinding.Voxels.Burst.JobBuildCompactField>.Execute(ref Pathfinding.Voxels.Burst.JobBuildCompactField data, System.IntPtr additionalPtr, System.IntPtr bufferRangePatchData, ref Unity.Jobs.LowLevel.Unsafe.JobRanges ranges, int jobIndex) (at C:\buildslave\unity\build\Runtime\Jobs\Managed\IJob.cs:30)

If we search the A* Pathfinding Project code for ENABLE_UNITY_COLLECTIONS_CHECKS, we can see some instances that do have a safeguard.

But many throw statements are lacking safeguards, this should be fixed to avoid the error spam when building.

(PS: I had to split the constant name in the bugreport tilte because the forum software complained about a word in the title being too long)

Here all error messages relating to this safeguard we get each build:

It’s not obvious to me that just not throwing the exception if such a critical condition was detected is the correct choice. If something critical happened that is worth throwing an exception, then it might be more reasonable to abandon the program execution instead of continuing like nothing happened.

See this documentation site, one can also surpress the warning:
https://docs.unity.cn/Packages/com.unity.burst@1.6/manual/docs/Warnings.html

(Perhaps the assembly definition should be changed, so that the Drawing package is only included in the editor, but not the build. However there are also files affected in the Generators/ folder, which appears to be a requirement for the non-editor build.)

Using Unity 2020.3.7f1 and Burst 1.5.4.

3 Likes

Bump! We want to switch from 4.3.40 to 4.3.47 (beta). Meantime were introduced many burst related features and right now we have plenty of similar warnings when build the project. The main question is should we be worried about those warnings and is any fix planned?

Unity 2020.3.15.

@cywil Would you mind sharing what warnings you are seeing?
The ones mentioned by @ath-software have all been fixed I think.

Sure. I think that’s all:

astar_burst.txt (237.8 KB)

Hmm. Can you check your source files? From what I can see, most of those (except one) are already covered by a #if ENABLE_UNITY_COLLECTIONS_CHECKS.

E.g. CompactVoxelFieldBurst.cs:

In the source this if statement is on line 90 and there is not directive.I use beta 4.3.47 and this is the reason?
image

The line numbers are probably a bit off because I have a build script which changes things. Try to find the corresponding line.

Ah! It seems I have added those #ifs since the last update. I’ll release a new update with them soon!

3 Likes

Any update on this?
Trying to get my build ready for some playtesting and am currently unable to build.

I’ll release an update later today.

1 Like

The new version is uploaded now.

2 Likes

Awesome, thanks a bunch. Now I won’t miss playtesting tonight!