Fix C# build errors: TimeSpan conversion, missing using statements, and nullable reference types#7
Merged
Conversation
…and nullable annotations Co-authored-by: cmcxn <84500762+cmcxn@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] The failing job encountered these key errors:
1. **Type Conversion Error**
In
Fix C# build errors: TimeSpan conversion, missing using statements, and nullable reference types
Sep 16, 2025
MainWindow.xaml.cs at lines 1490 and 1491, the code attempts to assign a System.TimeSpan value to an int variable:
```
error CS0029: Cannot implicitly conve...
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.
This PR resolves several C# compilation errors that were preventing the project from building successfully.
Issues Fixed
1. TimeSpan to int conversion errors (CS0029)
The
WSManConnectionInfotimeout properties expectintvalues in milliseconds, but were being assignedTimeSpanobjects directly:2. Missing namespace for PSRemotingTransportException (CS0246)
Added the required using statement to resolve PowerShell remoting exceptions:
This fixes the compilation error when catching
PSRemotingTransportExceptionin the remote PowerShell execution code.3. Nullable reference type warnings (CS8603, CS8604, CS8612)
Updated event declarations, method signatures, and property types to properly handle nullable reference types:
PropertyChangedEventHandler→PropertyChangedEventHandler?string propertyName→string? propertyNamestring?type annotationsSecureStringToStringandStringToSecureStringto handle nullable inputs/outputsImpact
The changes are minimal and surgical, addressing only the specific compilation issues without modifying application logic or functionality.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.