NovaSharp

Modernization Notes

NovaSharp now targets netstandard2.1 for all runtime components and net8.0 for tooling, ensuring out-of-the-box support for:

Completed Cleanup

Pending Alignments

Modernization Tooling

Keep this page current when additional modernization steps land (e.g., nullable annotations, trimming support, native AOT testing).

Value-Typed Enumeration Policy (2025-11-26)

Reflection Audit (Phase 1 – 2025-11-22)

Area Current reflection usage Next steps Status
LuaCompatibilityProfile display names CompatibilityVersionTests.DisplayNameHandlesLatestAlias used MethodInfo.Invoke on the private GetDisplayName helper to assert the Lua Latest alias. Expose the helper as an internal API so test code can call it without reflection. ✅ Addressed in this pass.
CLI Program tests ProgramTests reflects over the private InterpreterLoop and Banner methods to simulate REPL traffic and banner output. Introduce internal test hooks (e.g., an internal ProgramFacade or partial methods) so the NUnit suite can exercise the flows without BindingFlags.NonPublic. ✅ Added Program.RunInterpreterLoopForTests / Program.ShowBannerForTests (exposed via a partial class) and rewired ProgramTests to call those helpers directly, eliminating the MethodInfo usage.
Processor instruction tests ProcessorTests binds dozens of non-public VM helpers (e.g., Exec* methods, instruction decoding) via reflection to assert edge cases. Design an internal ProcessorTestAdapter that exposes the required hooks through InternalsVisibleTo, then migrate the tests off reflection. ✅ (2025-11-23 21:15 UTC) Introduced Processor.TestHooks (thread ownership, coroutine stack/value stack accessors, Exec*/Close/Stack helpers) plus Script.GetByteCodeForTests and Coroutine.GetProcessorForTests, then rewired ProcessorTests and ProcessorBinaryDumpTests to drop all reflection usage.
Descriptor helper tests DescriptorHelpersTests and related suites reach into private member descriptors via reflection to validate naming/visibility logic. Provide internal inspector types or builder APIs that surface the relevant state directly so the tests can drop the direct BindingFlags.NonPublic usage. ✅ (2025-11-23 22:10 UTC) Added metadata helpers on the descriptor fixtures (visibility/member/property/meta samples) and rewired DescriptorHelpersTests to consume those MethodInfo/FieldInfo/PropertyInfo accessors instead of calling Type.Get* with BindingFlags. Reflection is now centralized in the fixture helpers, eliminating the remaining direct reflection calls from the tests.
Descriptor builder/wiring tests The descriptor builder suites (PropertyMemberDescriptorTests, FieldMemberDescriptorTests, MethodMemberDescriptorTests) and the CLI descriptor helpers still cached metadata via Type.Get* + BindingFlags lookups on their fixtures. Switch the fixtures to expression-based metadata so the tests can capture FieldInfo/PropertyInfo/MethodInfo handles without invoking BindingFlags.NonPublic. ✅ (2025-11-23 23:55 UTC) Rebuilt the sample metadata helpers around expression trees, eliminating the remaining BindingFlags usage across the descriptor builder/wiring suites. Only the event fixture still reflects on a private add/remove pair while we design a test hook for that path.
FastStack tests FastStackTests invoked the private FastStack<T>.Zero via reflection to exercise the slot-clearing path. Expose an internal helper so tests can call the path directly through InternalsVisibleTo without reflection. ✅ (2025-11-22 11:29 UTC) Added FastStack<T>.TestHooks.ZeroSlot and updated FastStackTests to call the helper instead of BindingFlags.NonPublic, keeping the stack-clearing coverage without reflection.
Expression tests DynamicAndAdjustmentExpressionTests used reflection to call overridden Expression.Eval/Compile implementations via BindingFlags.DeclaredOnly. Call the virtual members directly (tests already have access via InternalsVisibleTo) so expression coverage no longer depends on reflection. ✅ (2025-11-22 11:45 UTC) Removed ExpressionTestHelpers, updated the tests to invoke expression.Eval/expression.Compile directly, and re-ran the targeted suites.
Processor debugger tests ProcessorDebuggerTests.RefreshDebuggerThreadsUsesParentCoroutineStack reflected over Coroutine._processor, Processor._coroutinesStack, and the private RefreshDebuggerThreads method to inspect thread state. Extend Processor.TestHooks/Coroutine helpers to expose the needed state and methods, then update the tests to call the hooks directly. ✅ (2025-11-22 11:43 UTC) Added Processor.RefreshDebuggerThreadsForTests and switched the debugger tests to use the existing coroutine stack/processor helpers, eliminating the remaining reflection usage in that suite.
String module tests StringModuleTests.AdjustIndexHandlesNilZeroPositiveAndNegativeInputs invoked the private StringModule.AdjustIndex via reflection to validate index handling. Expose an internal helper so tests can cover index normalization without reflection. ✅ (2025-11-22 11:52 UTC) Added StringModule.TestHooks.AdjustIndex and rewired the NUnit test to call the helper directly, removing the BindingFlags.NonPublic dependency.
Callback function tests CallbackFunctionTests retrieved MethodInfo instances for private callbacks via BindingFlags.NonPublic to exercise CheckCallbackSignature. Provide strongly typed metadata accessors so the tests can obtain the MethodInfo without reflection. ✅ (2025-11-22 11:57 UTC) Added delegate-based helpers on the nested SampleUserData fixture, allowing the tests to fetch the relevant MethodInfo values without using BindingFlags.
Event member descriptor tests EventMemberDescriptorTests.TryCreateIfVisibleRejectsPrivateEvents reflected directly on PrivateEventSource.HiddenEvent via BindingFlags.NonPublic. Introduce a metadata helper so the tests consume cached EventInfo instances without ad-hoc reflection. ✅ (2025-11-22 11:59 UTC) Added PrivateEventSourceMetadata.HiddenEvent and updated the test to use it, eliminating the direct GetEvent(..., BindingFlags.NonPublic) call.
Field member descriptor tests FieldMemberDescriptorTests.TryCreateIfVisibleRejectsNonPublicField used Type.GetField("_privateValue", BindingFlags.NonPublic) to access a private field. Provide a metadata helper that captures the FieldInfo once so tests no longer call GetField with BindingFlags.NonPublic. ✅ (2025-11-22 12:03 UTC) Added SampleFieldsMetadata.PrivateValue and rewired the test to consume it, keeping the reflection centralized and removing the inline BindingFlags usage.
CLR-to-script conversion tests ClrToScriptConversionsTests.ObjectToDynValueConvertsObjects reflected over StaticClrCallback via global BindingFlags combos to retrieve its MethodInfo. Cache the callback method info via a delegate helper so the test can reuse it without reflection. ✅ (2025-11-22 12:05 UTC) Added StaticClrCallbackMethodInfo and updated the test to consume it, eliminating the ad-hoc GetMethod call.

Tracking: this table is authoritative for reflection-audit detail. Keep only selected, unfinished milestones in PLAN.md; record completed work in the current progress/ session.