Skip to content

chore(deps): upgrade target frameworks to .NET 8/10 and update dependencies - #24

Open
samuelcaldas wants to merge 4 commits into
SciSharp:masterfrom
samuelcaldas:chore/upgrade-net8-net10-and-deps
Open

chore(deps): upgrade target frameworks to .NET 8/10 and update dependencies#24
samuelcaldas wants to merge 4 commits into
SciSharp:masterfrom
samuelcaldas:chore/upgrade-net8-net10-and-deps

Conversation

@samuelcaldas

Copy link
Copy Markdown
Contributor

Description

This PR modernizes the target frameworks and dependencies across the Gym.NET solution, upgrading from deprecated/out-of-support .NET Core 3.1 / .NET 6.0 to .NET 8.0 and .NET 10.0, while resolving security advisories in NuGet packages and fixing compatibility edge cases.

Key Changes

  • Target Frameworks: Upgraded projects to <TargetFrameworks>net8.0;net10.0</TargetFrameworks> (and net8.0-windows;net10.0-windows for WinForms / Test runners).
  • Package Updates:
    • SixLabors.ImageSharp: Upgraded to 2.1.13 (addresses GHSA-2cmq-823j-5qj8, GHSA-63p8-c4ww-9cg7, GHSA-65x7-c272-7g7r, etc.)
    • SixLabors.ImageSharp.Drawing: Upgraded to 1.0.0
    • SixLabors.Fonts: Upgraded to 1.0.1
    • JetBrains.Annotations: Upgraded to 2024.3.0
    • Avalonia & Avalonia.Desktop: Upgraded to 0.10.22
    • Microsoft.NET.Test.Sdk: Upgraded to 17.14.1
    • MSTest.TestAdapter / MSTest.TestFramework: Upgraded to 3.8.2
    • coverlet.collector: Upgraded to 6.0.4
  • Compatibility & Fixes:
    • LunarLanderEnv: Fixed DrawLine signature in SixLabors.ImageSharp.Drawing.
    • Box: Fixed 0-D scalar bounds checking and sampling empty slice exceptions.
    • StaticAvaloniaApp: Fixed application lifetime reuse across concurrent multi-instance test runs.
    • WinFormEnvViewer: Added headless/non-interactive fallback preventing ShowDialog modal exceptions on CI / Server environments.
  • Canonical SOT: Added Farama-Foundation/Gymnasium submodule reference under refs/Gymnasium.

Verification

  • Full solution build passed on Release configuration.
  • 15/15 tests passing on both .NET 8.0 and .NET 10.0 runtimes (MSTest).

🤖 Generated with Claude Code

samuelcaldas and others added 3 commits September 3, 2026 12:50
Co-Authored-By: Claude Code <noreply@anthropic.com>
Co-Authored-By: Claude Code <noreply@anthropic.com>
…packages

- Update TargetFrameworks across projects to net8.0 and net10.0
- Upgrade SixLabors.ImageSharp to 2.1.13, ImageSharp.Drawing to 1.0.0, and Fonts to 1.0.1
- Upgrade Avalonia and Avalonia.Desktop to 0.10.22
- Upgrade MSTest.TestAdapter and MSTest.TestFramework to 3.8.2, Test.Sdk to 17.14.1
- Fix SixLabors.ImageSharp.Drawing DrawLine API usage in LunarLanderEnv
- Fix 0D scalar shape bounds and sampling logic in Box space
- Fix Avalonia application lifetime multi-instance reuse in StaticAvaloniaApp
- Guard WinFormEnvViewer against headless/non-interactive modal dialog crashes

Co-Authored-By: Claude Code <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings September 3, 2026 17:28

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The PR introduces at least one likely compile-breaking API call in ImageSharp.Drawing usage and a potential deadlock path in Avalonia initialization that should be fixed before merging.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR upgrades the Gym.NET solution to modern .NET target frameworks and refreshes key NuGet dependencies (notably ImageSharp/Avalonia/test tooling), while adding compatibility fixes to keep environments/rendering and tests working under the newer stack.

Changes:

  • Retargeted projects and test runners to net8.0 / net10.0 (and *-windows where applicable) and updated major dependencies (ImageSharp, Avalonia, MSTest, coverlet, etc.).
  • Updated environment/rendering code for compatibility (Box scalar sampling, Avalonia multi-instance lifetime reuse, WinForms headless fallback, ImageSharp drawing call).
  • Added documentation and repository metadata for the Gymnasium “source of truth” submodule (refs/Gymnasium).
File summaries
File Description
tests/Gym.Tests/Gym.Tests.csproj Updates test target frameworks and MSTest/coverlet package versions.
tests/Gym.Tests/Envs/Aether/LunarLanderEnvironment.cs Updates deterministic baseline expectations for LunarLander tests under new runtimes.
src/Gym/Spaces/Box.cs Fixes scalar Box sampling and avoids empty-mask sampling/indexing failures.
src/Gym/Gym.csproj Retargets core library to net8/net10 and updates key package references.
src/Gym.Rendering.WinForm/Rendering/WinFormEnvViewer.cs Adjusts WinForms viewer run-loop for headless/non-interactive environments.
src/Gym.Rendering.WinForm/Gym.Rendering.WinForm.csproj Retargets WinForms rendering project to newer Windows TFMs.
src/Gym.Rendering.Avalonia/StaticAvaloniaApp.cs Reworks Avalonia app lifetime/threading to support reuse across concurrent test instances.
src/Gym.Rendering.Avalonia/Gym.Rendering.Avalonia.csproj Retargets Avalonia rendering project and updates Avalonia/ImageSharp package versions.
src/Gym.Environments/Gym.Environments.csproj Retargets environments project and updates ImageSharp/ImageSharp.Drawing/Fonts/Annotations dependencies.
src/Gym.Environments/Envs/Aether/LunarLanderEnv.cs Updates ImageSharp drawing call for helipad pole rendering.
docs/sot/gymnasium_sot_reference.md Adds documentation describing Gymnasium as the canonical SOT and submodule placement.
CLAUDE.md Adds repository guidance/documentation for contributor tooling and architecture.
.gitmodules Adds refs/Gymnasium submodule definition pointing to Farama-Foundation/Gymnasium.
Review details
  • Files reviewed: 16/16 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

PointF flag2 = new PointF(x1, flag_y2);
// Pole
img.Mutate(i => i.DrawLines(new Rgba32(255, 255, 255), 1, new PointF[] { flag1, flag2 }));
img.Mutate(i => i.DrawLine(new Rgba32(255, 255, 255), 1f, new PointF[] { flag1, flag2 }));
Comment on lines +35 to 55
var app = BuildAvaloniaApp();
var appStartedEvent = new ManualResetEventSlim(false);
_thread = new Thread(() => {
_lifetime = new ClassicDesktopStyleApplicationLifetime()
{
Args = Array.Empty<string>(),
ShutdownMode = ShutdownMode.OnExplicitShutdown
};

app.SetupWithLifetime(_lifetime);
_app = app.Instance;
_initialized = true;
appStartedEvent.Set();
_lifetime.Start(Array.Empty<string>());
});
_thread.IsBackground = true;
_thread.Name = $"{nameof(AvaloniaEnvViewer)} {(string.IsNullOrEmpty(title) ? "" : $"-{title}")}";
_thread.Start();

appStartedEvent.Wait();
}
…ology

- Add PRD.md and ROADMAP.md defining Gymnasium migration requirements and milestones
- Add docs/README.md central documentation hub and developer index
- Add architectural specifications for Core Lifecycle, Spaces, Wrappers, Vector Envs, and Rendering
- Add docs/architecture/ontology.json machine-readable ontology graph for guide agents
- Add Farama Gymnasium SOT mapping matrix and golden trajectory baseline specs
- Add developer guides for testing, build automation, and custom environment authoring

Co-Authored-By: Claude Code <noreply@anthropic.com>
@Nucs

Nucs commented Sep 4, 2026

Copy link
Copy Markdown
Member

@samuelcaldas This looks great and I would happily like to merge your work. To stay up to the standard:

  • This library was a byte-perfect port of https://github.com/openai/gym which was deprecrated at 2021 and no longer maintained.
    https://github.com/Farama-Foundation/Gymnasium is the replacement and our entire library must move to use this library as source of truth, including breaking changes, docs, roadmaps.
    I saw that you already did that to some degree but we need to have this well established throughout the library and porting Gymnasium is the underlined goal (but not limited to only port).
  • I do need you to ensure that if we are to port other (from any source, gymnasium or external) environments/games then they must be pixel-perfect and byte-perfect.
  • Since you are modernizing the implementation, move to NumSharp 0.60.0 (0.70.0 is soon to be out with 85% of NumPy api support).

Let me know if you would like to challenge my requirements or separate into more PRs.
This project is and will be open for contributions.

@Nucs

Nucs commented Sep 4, 2026

Copy link
Copy Markdown
Member

See if you can take in after this is merged the modernization of this merge request too #13
@bojake has spent well written and manual time on this

samuelcaldas added a commit to samuelcaldas/Gym.NET that referenced this pull request Sep 5, 2026
…ndate

- Establish Farama Gymnasium (refs/Gymnasium) as mandatory SOT across Gym.NET
- Enforce byte-perfect state transitions and pixel-perfect visual rendering
- Add NumSharp >= 0.60.0 and 0.70.0 modernization policy per SciSharp maintainer feedback
- Add Milestone 5 (PR SciSharp#24 review polish & NumSharp 0.60.0 upgrade)
- Add Milestone 6 (Community PR SciSharp#13 CarRacing-v2 modernization backlog)
- Add Milestone 7 (NumSharp 0.70.0 & Box2D robotics suite backlog)
- Update SOT references, PRD specifications, and live docs hub

Co-Authored-By: Claude Code <noreply@anthropic.com>
samuelcaldas added a commit to samuelcaldas/Gym.NET that referenced this pull request Sep 5, 2026
…rp 0.60.0 upgrade

- Upgrade NumSharp across Gym, Gym.Environments, and examples from NumSharp.Lite 0.1.12 / 0.20.4 to NumSharp 0.60.0
- Adapt Spaces (Box, Discrete, MultiDiscrete, MultiBinary, GraphSpace, OneOfSpace, TextSpace) and Vector environments to NumSharp 0.60.0 indexing and API conventions
- Harden Avalonia application lifetime in StaticAvaloniaApp with timeout and exception propagation
- Fix ImageSharp Drawing API in LunarLanderEnv with safe line rendering and degenerate clipping guards
- Modernize ReinforcementLearning examples and Parameter Runner to .NET 8 / .NET 10
- Re-verify 100% passing automated test suite (79/79) on both .NET 8.0 and .NET 10.0
- Update ROADMAP.md marking Milestone 5 as completed

Co-Authored-By: Claude Code <noreply@anthropic.com>
@Nucs

Nucs commented Sep 5, 2026

Copy link
Copy Markdown
Member

@samuelcaldas
I have commented on the code, comments that apply to the entire codebase although mentioned on one instance.
Also if you could ensure that your model is either opus 4.8 (not opus 5) or any fable. Effort has to be xhigh/max, not less. Otherwise you are risking adding chaos and bugs you'll be wasting more time fixing later on.
Make sure to have the refs/NumSharp submodule on main (or branch "journey3" for soon to be 0.70.0) so latest NumSharp codebase will be accessible for the agent to learn and understand. Otherwise agents right now are trained on NumSharp 0.30.0 which is outdated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants