Repository navigation
Conversation
[Medium impact] The change affects scalar string requests in SimVar workflows. The string-unit fix should cover struct subscriptions before merging. Findings
Fix with agent prompt### Issue 1
src/SimConnect.NET/SimVar/SimVarManager.cs:866-868
The fix only covers scalar subscriptions. `Subscribe<T>(period, onValue)` calls `EnsureTypeDefinition<T>`, which still passes `unit ?? string.Empty` to `SimConnect_AddToDataDefinition`. String fields therefore send `"string"` or an empty string instead of the required null pointer, so these subscriptions remain broken. Apply the same string-type check in that registration path.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.SummaryThis PR sends a null unit when registering scalar string SimVars and allows null in the native declaration.
Reviews (1) · Last reviewed commit: "fix: use null unit when subscribing to s..." · Reviewed by Greptile |
| if (IsStringDataType(dt)) | ||
| { | ||
| unit = null; |
There was a problem hiding this comment.
Struct subscriptions still fail
The fix only covers scalar subscriptions. Subscribe<T>(period, onValue) calls EnsureTypeDefinition<T>, which still passes unit ?? string.Empty to SimConnect_AddToDataDefinition. String fields therefore send "string" or an empty string instead of the required null pointer, so these subscriptions remain broken. Apply the same string-type check in that registration path.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/SimConnect.NET/SimVar/SimVarManager.cs
Line: 866-868
Comment:
**Struct subscriptions still fail**
The fix only covers scalar subscriptions. `Subscribe<T>(period, onValue)` calls `EnsureTypeDefinition<T>`, which still passes `unit ?? string.Empty` to `SimConnect_AddToDataDefinition`. String fields therefore send `"string"` or an empty string instead of the required null pointer, so these subscriptions remain broken. Apply the same string-type check in that registration path.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
Summary
Fixes a bug that prevented subscribing to string SimVars. The library previously passed
"string"as the unit, but SimConnect requires the unit to benullfor string data types.Changes Made
nullas the unit when creating data definitions for string SimVars.Additional Information
Author Information
Discord Username: airxiti
Checklist: