Upgrade to NET8#114
Merged
oliverbock merged 23 commits intoJavascriptNet:masterfrom Dec 19, 2025
Merged
Conversation
…o SDK-style Co-authored-by: bwinsley <64841770+bwinsley@users.noreply.github.com>
…lity Co-authored-by: bwinsley <64841770+bwinsley@users.noreply.github.com>
Co-authored-by: bwinsley <64841770+bwinsley@users.noreply.github.com>
Co-authored-by: bwinsley <64841770+bwinsley@users.noreply.github.com>
…ting a local handle
…ild and run tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Original PR was merged into master without squashing. @oliverbock and I attempted a squash and force push which somehow broke the git history. Master has since been restored so I am redoing this PR which we will squash and rebase.
===========================================
This pull request modernizes the project by upgrading it from .NET Framework 4.7.2 to .NET 8, updating build configurations, and improving memory management for managed JavaScript function wrappers. It also revises documentation and sample code to reflect these changes, ensuring compatibility with current development tools and practices.
.NET 8 Migration and Build System Updates:
Fiddling.csprojandJavaScript.Net.vcxprojto .NET 8 SDK-style projects, removed legacy .NET Framework settings, and updated platform/toolset requirements for C++/CLI to useCLRSupport=NetCore. [1] [2]JavaScript.Net.slnfor Visual Studio 2022/2019 and removed references to older Visual Studio versions.app.configand legacy assembly references, as .NET 8 includes most system assemblies by default. [1] [2]Changes to method of tracking and garbage collecting JavascriptExternals
GCHandleto unmanagedc++code would cause issues in NET8 and accessing methods on it such asGCHandle.Targetwould throwSystem.AccessViolationException.GCHandle.ToIntPtrto obtain a pointer which we can pass to unmanaged codeMemory Management Enhancements:
JavascriptFunctionWrapperandWrappedJavascriptFunction) for managed JavaScript function objects, enabling proper cleanup of V8 handles and managed references when the context is disposed. Updated construction and disposal logic in both header and implementation files. [1] [2] [3] [4]Program.csinFidding.csproj[1] [2] [3]Before:

After:
This upgrade brings the project up to date with current .NET and Visual Studio standards, improves reliability and maintainability, and provides clearer guidance for users and contributors.