Fix KeyNotFoundException when simulator lacks runtimeIdentifier or version#1501
Merged
simonrozsival merged 9 commits intomainfrom Nov 25, 2025
Merged
Conversation
…dd tests Co-authored-by: simonrozsival <374616+simonrozsival@users.noreply.github.com>
Co-authored-by: simonrozsival <374616+simonrozsival@users.noreply.github.com>
Co-authored-by: simonrozsival <374616+simonrozsival@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix SimulatorsCommand.IsInstalled for missing runtimeIdentifier
Fix KeyNotFoundException when simulator lacks runtimeIdentifier
Nov 19, 2025
src/Microsoft.DotNet.XHarness.CLI/Commands/Apple/Simulators/SimulatorsCommand.cs
Outdated
Show resolved
Hide resolved
tests/Microsoft.DotNet.XHarness.CLI.Tests/Commands/Apple/SimulatorsCommandTests.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: simonrozsival <374616+simonrozsival@users.noreply.github.com>
…rsion Co-authored-by: simonrozsival <374616+simonrozsival@users.noreply.github.com>
Contributor
Author
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Copilot
AI
changed the title
Fix KeyNotFoundException when simulator lacks runtimeIdentifier
Fix KeyNotFoundException when simulator lacks runtimeIdentifier or version
Nov 19, 2025
Co-authored-by: simonrozsival <374616+simonrozsival@users.noreply.github.com>
Co-authored-by: simonrozsival <374616+simonrozsival@users.noreply.github.com>
Member
kotlarmilos
approved these changes
Nov 25, 2025
Member
|
There is a failing tests in Helix related to permissions. I'm quite sure it's not related to this PR, is that just a flaky test? |
Member
|
This happened here as well #1504, so it isn't related to this PR |
Member
|
/ba-g #1509 |
Member
|
/backport to release/10.0 |
|
Started backporting to |
kotlarmilos
pushed a commit
to kotlarmilos/xharness
that referenced
this pull request
Mar 16, 2026
…rsion (dotnet#1501) * Initial plan * Fix SimulatorsCommand to skip entries without runtimeIdentifier and add tests Co-authored-by: simonrozsival <374616+simonrozsival@users.noreply.github.com> * Completed fix for SimulatorsCommand runtimeIdentifier issue Co-authored-by: simonrozsival <374616+simonrozsival@users.noreply.github.com> * Remove accidentally committed nuget.exe Co-authored-by: simonrozsival <374616+simonrozsival@users.noreply.github.com> * Address review feedback: check version property and improve tests Co-authored-by: simonrozsival <374616+simonrozsival@users.noreply.github.com> * Fix KeyNotFoundException when simulator lacks runtimeIdentifier or version Co-authored-by: simonrozsival <374616+simonrozsival@users.noreply.github.com> * Remove SimulatorsCommandTests as requested Co-authored-by: simonrozsival <374616+simonrozsival@users.noreply.github.com> * Remove nuget.exe and add to .gitignore Co-authored-by: simonrozsival <374616+simonrozsival@users.noreply.github.com> * Remove unnecessary changes from gitignore --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: simonrozsival <374616+simonrozsival@users.noreply.github.com> Co-authored-by: Simon Rozsival <simon@rozsival.com>
kotlarmilos
pushed a commit
to kotlarmilos/xharness
that referenced
this pull request
Mar 16, 2026
…rsion (dotnet#1501) * Initial plan * Fix SimulatorsCommand to skip entries without runtimeIdentifier and add tests Co-authored-by: simonrozsival <374616+simonrozsival@users.noreply.github.com> * Completed fix for SimulatorsCommand runtimeIdentifier issue Co-authored-by: simonrozsival <374616+simonrozsival@users.noreply.github.com> * Remove accidentally committed nuget.exe Co-authored-by: simonrozsival <374616+simonrozsival@users.noreply.github.com> * Address review feedback: check version property and improve tests Co-authored-by: simonrozsival <374616+simonrozsival@users.noreply.github.com> * Fix KeyNotFoundException when simulator lacks runtimeIdentifier or version Co-authored-by: simonrozsival <374616+simonrozsival@users.noreply.github.com> * Remove SimulatorsCommandTests as requested Co-authored-by: simonrozsival <374616+simonrozsival@users.noreply.github.com> * Remove nuget.exe and add to .gitignore Co-authored-by: simonrozsival <374616+simonrozsival@users.noreply.github.com> * Remove unnecessary changes from gitignore --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: simonrozsival <374616+simonrozsival@users.noreply.github.com> Co-authored-by: Simon Rozsival <simon@rozsival.com>
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.
Fix: Skip Simulators Without runtimeIdentifier ✅
Fixed the issue where
SimulatorsCommand.IsInstalled()throwsKeyNotFoundExceptionwhen encountering simulator entries without aruntimeIdentifierorversionproperty in the JSON output fromxcrun simctl runtime list -j.Checklist:
runtimeIdentifierproperty existence before accessing itversionproperty existence (review feedback)Changes Made:
Modified
SimulatorsCommand.cs:runtimeIdentifierusingTryGetProperty()- entries without this property are skippedversionproperty usingTryGetProperty()- returns null if missingModified
.gitignore:.nuget/nuget.exeto prevent accidental commits of the NuGet executableTest Results:
Fixes #1500
Original prompt
This section details on the original issue you should resolve
<issue_title>[apple] SimulatorsCommand.IsInstalled throws when a simulator does not have runtimeIdentifier</issue_title>
<issue_description>Xharness throws when it encounters a Simulator JSON without
runtimeIdentifier. From failing MAUI CI build: