-
-
Notifications
You must be signed in to change notification settings - Fork 3
Version 0.1.17 #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Version 0.1.17 #13
Conversation
…12) * Add struct-based SimVar set functionality Introduces IFieldWriter, SimVarFieldWriter, and SimVarFieldWriterFactory to enable writing SimVar-annotated structs into unmanaged buffers. Adds SimVarManager.SetAsync<T> and SetStructAsync for setting multiple SimVars in one call using a struct. Updates tests to verify struct-based SimVar setting and restoration. * Improve SimConnect struct writing and error handling Refactored string field writing to ensure explicit null-termination and use Latin1 encoding for SimConnect compatibility. Added caching of struct writers and total size in SimVarManager for efficient SetDataOnSimObject calls. Improved error handling and updated attribute references from [SimVar] to [SimConnect].
- Added ExceptionHelper for improved exception handling in various components. - Enhanced SimVar type inference for automatic detection of SimConnectDataInitPosition. - Improved struct-based SimVars.SetAsync<TStruct> for better performance and error handling. - Updated logging mechanisms to use ExceptionHelper for critical exception filtering. - Refined input event processing with defensive coding practices. - Maintained integration tests for better coverage and reliability. - Fixed issues with struct writers and SimVarManager logging.
llamavert
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces version 0.1.17 of SimConnect.NET with improvements focused on exception handling, struct-based SimVar operations, input event parsing robustness, and test infrastructure stability.
- Adds a central
ExceptionHelperto distinguish critical from non-critical exceptions across background loops - Enhances struct-based SimVar writing with cached writers and improved ANSI string encoding
- Strengthens input event parsing with defensive fallbacks and guarded type conversions
Reviewed Changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| Directory.Build.props | Bumps package version to 0.1.17 |
| CHANGELOG.md | Documents all changes in version 0.1.17 |
| src/SimConnect.NET/Internal/ExceptionHelper.cs | Adds new helper to identify critical exceptions that should not be swallowed |
| src/SimConnect.NET/SimConnectClient.cs | Adds exception filtering and improves cancellation logging |
| src/SimConnect.NET/SimConnectLogger.cs | Adds exception filtering, improves error reporting, and uses Path.Join |
| src/SimConnect.NET/SimVar/SimVarManager.cs | Adds cached struct writers, exception filtering, null-unit support, and type inference for SimConnectDataInitPosition |
| src/SimConnect.NET/SimVar/Internal/SimVarRequest.cs | Adds exception filtering and logging for user callback errors |
| src/SimConnect.NET/SimVar/Internal/SimVarFieldReaderFactory.cs | Updates error message to reference [SimConnect] attribute |
| src/SimConnect.NET/SimVar/Internal/SimVarFieldWriterFactory.cs | Updates error message and removes dead code assignment |
| src/SimConnect.NET/SimVar/Internal/SimVarFieldWriter.cs | Refactors string encoding to use Latin1 with explicit null termination |
| src/SimConnect.NET/InputEvents/InputEventManager.cs | Adds exception filtering and defensive input event parsing |
| src/SimConnect.NET/InputEvents/InputEventValue.cs | Refines exception handling in TryGetDoubleValue and simplifies TryGetStringValue |
| src/SimConnect.NET/AI/SimObjectType.cs | Refactors GetAllContainerTitles to use LINQ |
| tests/SimConnect.NET.Tests.Net8/Tests/TestRunner.cs | Refactors to reuse single SimConnectClient and updates test iteration |
| tests/SimConnect.NET.Tests.Net8/Tests/ConnectionTests.cs | Replaces unused local variables with discard operator |
| tests/SimConnect.NET.Tests.Net8/Tests/AIObjectTests.cs | Uses explicit double casts for position offset calculations |
Comments suppressed due to low confidence (1)
tests/SimConnect.NET.Tests.Net8/Tests/TestRunner.cs:121
- This foreach loop immediately maps its iteration variable to another variable - consider mapping the sequence explicitly using '.Select(...)'.
foreach (var resultTask in testsToRun.Select(test => this.RunSingleTestAsync(test)))
{
var result = await resultTask;
results.Add(result);
if (!result.Passed && options.StopOnFirstFailure)
{
Console.WriteLine("🛑 Stopping on first failure as requested");
break;
}
// Small delay between tests
await Task.Delay(500);
Console.WriteLine();
}
Summary
This pull request delivers a set of improvements aimed at making SimConnect.NET more reliable, predictable, and easier to diagnose. It introduces safer exception handling across all background loops, improves struct based SimVar writing, strengthens input event parsing, and updates integration tests for better stability. The release also bumps the version to 0.1.17 and updates the changelog.
Changes Made
Additional Information
These changes collectively make exception behaviour more predictable, improve SimVar struct layout correctness, reduce hidden crashes in user code paths, and strengthen the overall test harness to prevent intermittent failures.
Author Information
Discord Username: AussieScorcher
Checklist: