fix(engine): add volatile to AnglePredictor lock field and Models content copy

- Mark _loadAttempted as volatile for correct double-checked locking
- Add Content item to copy Models/ directory to output for ONNX inference

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-14 20:33:07 -04:00
parent e33b5ba063
commit 9cc6cfa1b1
2 changed files with 4 additions and 1 deletions

View File

@@ -12,7 +12,7 @@ namespace OpenNest.Engine.ML
public static class AnglePredictor
{
private static InferenceSession _session;
private static bool _loadAttempted;
private static volatile bool _loadAttempted;
private static readonly object _lock = new();
public static List<double> PredictAngles(

View File

@@ -10,4 +10,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.ML.OnnxRuntime" Version="1.17.3" />
</ItemGroup>
<ItemGroup>
<Content Include="Models\**" CopyToOutputDirectory="PreserveNewest" Condition="Exists('Models')" />
</ItemGroup>
</Project>