Upgrade to .NET 8 and replace Thread.Abort with CancellationToken - #3
Open
dsn27 wants to merge 1 commit into
Open
Upgrade to .NET 8 and replace Thread.Abort with CancellationToken#3dsn27 wants to merge 1 commit into
dsn27 wants to merge 1 commit into
Conversation
- Retarget all projects: netstandard2.0/net48/net6.0 → net8.0-windows (net8.0 for netDxf) - Update System.Drawing.Common and System.Text.Encoding.CodePages to 8.0.0 - Add EnableUnsafeBinaryFormatterSerialization=true to all projects to keep existing ISerializable code working - Add System.Configuration.ConfigurationManager 8.0.0 to .Forms and .App for Settings support - Bump test framework packages (MSTest 3.1.1, TestSdk 17.8.0, coverlet 6.0.0) - Remove all LangVersion 7.3 restrictions from configuration groups - Remove legacy net48-style <Reference> items replaced by SDK auto-includes - Fix hardcoded VS path and packages.config MathNet reference in DebuggerVisualizers - Replace Thread.Abort() with CancellationTokenSource in ConstrHatchInside.cs - Update CI workflow to .NET SDK 8.0.x and corrected output path - Remove NET4X target from netDxf (net48 dropped) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01X3aoafmguA8XPwQTqSGHzP
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.
Summary
This PR modernizes the CADability codebase by upgrading all projects to .NET 8.0 and replacing the deprecated
Thread.Abort()pattern withCancellationTokenSourcefor graceful thread cancellation.Key Changes
Threading Improvements (ConstrHatchInside.cs)
Thread.Abort()calls withCancellationTokenSource.Cancel()for safer thread terminationfindShapeCtsfield to manage cancellation tokensThreadAbortExceptioncatch block (no longer needed with cancellation tokens)ThreadStartdelegateFramework Upgrades
netstandard2.0tonet8.0-windowsnet48tonet8.0-windowsnet48tonet8.0-windowsnet48tonet8.0-windowsnet6.0-windowstonet8.0-windowsnet48;net6.0) to singlenet8.0targetDependency Updates
System.Drawing.Common: 6.0.0 → 8.0.0System.Text.Encoding.CodePages: 6.0.0 → 8.0.0System.Configuration.ConfigurationManager: Added (8.0.0)LangVersion 7.3) and platform-specific settingsProject Configuration
EnableUnsafeBinaryFormatterSerializationproperty to all projects for backward compatibilityImplementation Details
The thread cancellation refactoring maintains the same functional behavior while using modern .NET patterns. The
CancellationTokenSourceprovides a cleaner, safer way to signal thread cancellation without the risks associated withThread.Abort().https://claude.ai/code/session_01X3aoafmguA8XPwQTqSGHzP