Skip to content

Commit a1f7876

Browse files
Fix C# 9.0 Compilation Errors (#548)
* auto-claude: subtask-1-1 - Convert record struct to struct Convert record struct declarations to regular struct declarations to fix CS8773 compilation errors. Record struct is a C# 10 feature that may not be available in the target C# version. Changes: - JActionTask.cs: internal record struct -> internal struct - JActionRunner.cs: private record struct JActionUpdate -> private struct - JActionAwaitable.cs: public readonly record struct -> public readonly struct with explicit fields and constructors for JActionAwaitable and JActionAwaiter Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * auto-claude: subtask-1-2 - Wrap TestRunnerCallbacks.cs in #if UNITY_INCLUDE_TESTS Wrapped entire TestRunnerCallbacks.cs file in conditional compilation directive to fix CS0234/CS0246 errors when Unity Test Framework is not included in the project. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 128f054 commit a1f7876

4 files changed

Lines changed: 26 additions & 4 deletions

File tree

UnityProject/Packages/com.jasonxudeveloper.jengine.core/Editor/Misc/TestRunnerCallbacks.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#if UNITY_INCLUDE_TESTS
12
using UnityEditor;
23
using UnityEditor.TestTools.TestRunner.Api;
34
using UnityEngine;
@@ -73,3 +74,4 @@ public void TestStarted(ITestAdaptor test) { }
7374
public void TestFinished(ITestResultAdaptor result) { }
7475
}
7576
}
77+
#endif

UnityProject/Packages/com.jasonxudeveloper.jengine.util/Runtime/Internal/JActionRunner.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ internal static class JActionRunner
4141
/// <summary>
4242
/// Marker struct for identifying our update in the PlayerLoop.
4343
/// </summary>
44-
private record struct JActionUpdate;
44+
private struct JActionUpdate { }
4545

4646
#if UNITY_EDITOR
4747
[InitializeOnLoadMethod]

UnityProject/Packages/com.jasonxudeveloper.jengine.util/Runtime/Internal/JActionTask.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ internal enum JActionTaskType : byte
4141
/// This struct is designed for minimal memory footprint and efficient execution.
4242
/// State is stored externally via <see cref="IStateStorage"/> to avoid boxing value types.
4343
/// </remarks>
44-
internal record struct JActionTask
44+
internal struct JActionTask
4545
{
4646
/// <summary>The type of task operation.</summary>
4747
internal JActionTaskType Type;

UnityProject/Packages/com.jasonxudeveloper.jengine.util/Runtime/JActionAwaitable.cs

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,18 @@ namespace JEngine.Util
2121
/// for proper compiler warnings when not awaited.
2222
/// </para>
2323
/// </remarks>
24-
public readonly record struct JActionAwaitable(JAction Action)
24+
public readonly struct JActionAwaitable
2525
{
26+
/// <summary>The JAction instance being awaited.</summary>
27+
public readonly JAction Action;
28+
29+
/// <summary>
30+
/// Initializes a new instance of the <see cref="JActionAwaitable"/> struct.
31+
/// </summary>
32+
/// <param name="action">The JAction to await.</param>
33+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
34+
public JActionAwaitable(JAction action) => Action = action;
35+
2636
/// <summary>
2737
/// Gets the awaiter for this awaitable.
2838
/// </summary>
@@ -39,8 +49,18 @@ public readonly record struct JActionAwaitable(JAction Action)
3949
/// This struct implements <see cref="ICriticalNotifyCompletion"/> to support
4050
/// both regular and unsafe continuations, enabling efficient async state machine behavior.
4151
/// </remarks>
42-
public readonly record struct JActionAwaiter(JAction Action) : ICriticalNotifyCompletion
52+
public readonly struct JActionAwaiter : ICriticalNotifyCompletion
4353
{
54+
/// <summary>The JAction instance being awaited.</summary>
55+
public readonly JAction Action;
56+
57+
/// <summary>
58+
/// Initializes a new instance of the <see cref="JActionAwaiter"/> struct.
59+
/// </summary>
60+
/// <param name="action">The JAction to await.</param>
61+
[MethodImpl(MethodImplOptions.AggressiveInlining)]
62+
public JActionAwaiter(JAction action) => Action = action;
63+
4464
/// <summary>
4565
/// Gets whether the <see cref="JAction"/> has completed execution.
4666
/// </summary>

0 commit comments

Comments
 (0)