Skip to content

Commit a92dd60

Browse files
committed
docs: add #333 issue note
1 parent 3d82b7e commit a92dd60

File tree

2 files changed

+47
-2
lines changed

2 files changed

+47
-2
lines changed

Documentation~/docfx.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@
2020
],
2121
"markdownEngineName": "markdig",
2222
"markdownEngineProperties": {
23-
"markdigExtensions": [ "footnotes" ]
23+
"markdigExtensions": [ "footnotes" ],
24+
"alerts": {
25+
"QUOTE": "alert alert-info"
26+
}
2427
},
2528
"content": [
2629
{"files": ["index.md", "toc.yml"]},

Documentation~/manual/known-issues.md

+43-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,50 @@
11
# Known Issues
22

3-
Currently, there are no known issues. If you found a bug, please report it by opening a **[GitHub issue]**.
3+
Below you can find current known issues. If you found a bug, please report it by opening a **[GitHub issue]**.
4+
5+
### [#333]: AtomicSafetyHandle may throw InvalidOperationException
6+
7+
`[email protected]+` has an unresolved bug, as you can read [here](https://docs.unity3d.com/Packages/[email protected]/manual/issues.html):
8+
9+
> [!QUOTE]
10+
> All containers allocated with `Allocator.Temp` on the same thread use a shared `AtomicSafetyHandle` instance rather than each having their own.
11+
12+
This can lead to safety check error throws like this:
13+
14+
```txt
15+
InvalidOperationException: The Unity.Collections.NativeList`1[System.Int32]
16+
has been declared as [WriteOnly] in the job, but you are reading from it.
17+
```
18+
19+
when using [`UnsafeTriangulator`][unsafe-triangulator] with `Allocator.Temp`. Consider the following example:
20+
21+
```csharp
22+
using var positions = new NativeList<double2>(Allocator.Temp);
23+
positions.Add(...);
24+
25+
new UnsafeTriangulator().Triangulate(input: new(){ Positions = positions.AsArray() }, ...);
26+
```
27+
28+
Unfortunately, due to `AsArray()` call, which should be safe, the above example will trigger an exception from the safety handle.
29+
Currently the only way to resolve this issue is:
30+
31+
- Disable safety checks, or
32+
- Call [`ToArray(Allocator)`][to-array]
33+
34+
I recommend the second option, calling [ToArray][to-array], unless you are certain about what you are doing.
35+
36+
```csharp
37+
using var positions = new NativeList<double2>(Allocator.Temp);
38+
positions.Add(...);
39+
40+
using var p = postions.ToArray(Allocator.Temp);
41+
new UnsafeTriangulator().Triangulate(input: new(){ Positions = p }, ...);
42+
```
443

544
[GitHub issue]: https://github.com/andywiecko/BurstTriangulator/issues/new?template=Blank+issue
45+
[#333]: https://github.com/andywiecko/BurstTriangulator/issues/333
46+
[unsafe-triangulator]: xref:andywiecko.BurstTriangulator.LowLevel.Unsafe.UnsafeTriangulator
47+
[to-array]: https://docs.unity3d.com/Packages/[email protected]/api/Unity.Collections.NativeList-1.html#Unity_Collections_NativeList_1_ToArray_Unity_Collections_AllocatorManager_AllocatorHandle_
648

749
---
850

0 commit comments

Comments
 (0)