Dev Home can randomly crash when updating properties on Environments page #2947
Labels
Area-Environments
Issue-Bug
Something isn't working or needs investigation
Priority-1
Resolution-Fix-Available
Available in a release
Severity-Crash
Bug that is causing a crash
Milestone
Dev Home version
No response
Windows build number
No response
Other software
No response
Steps to reproduce the bug
When an operation is perform in the environments page. E.g Starting/Stopping an environment we update the properties. For an unknown reason at this time the ObservableCollection can throw an exception when performing the OnCollectionChanged method. When an operation completes we update the properties for that environment as they could have changed. So we remove all the original values from the list and then add the new ones.
I added a try/catch in this PR: #2892
for the removal case : but I realize we still attempt to add to the collection later on after the orginal throws. Also this seems to happen randomly it is better to cover both in a try/catch so we don't crash Dev Home.
example trace:
`
[2024/05/16 09:44:38.049 ERR] (ComputeSystemHelpers) Unable to remove items from the collection
System.Runtime.InteropServices.COMException (0x80004005): Unspecified error
Unspecified error
at WinRT.ExceptionHelpers.g__Throw|39_0(Int32 hr)
at ABI.System.Collections.Specialized.NotifyCollectionChangedEventHandler.NativeDelegateWrapper.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
at System.Collections.ObjectModel.ObservableCollection
1.OnCollectionChanged(NotifyCollectionChangedEventArgs e) at DevHome.Common.Environments.Helpers.ComputeSystemHelpers.RemoveAllItems[T](ObservableCollection
1 collection)[2024/05/16 09:44:38.164 ERR] (ComputeSystemHelpers) Unable to remove items from the collection
System.Runtime.InteropServices.COMException (0x80004005): Unspecified error
Unspecified error
at WinRT.ExceptionHelpers.g__Throw|39_0(Int32 hr)
at ABI.System.Collections.Specialized.NotifyCollectionChangedEventHandler.NativeDelegateWrapper.Invoke(Object sender, NotifyCollectionChangedEventArgs e)
at System.Collections.ObjectModel.ObservableCollection
1.OnCollectionChanged(NotifyCollectionChangedEventArgs e) at DevHome.Common.Environments.Helpers.ComputeSystemHelpers.RemoveAllItems[T](ObservableCollection
1 collection)`
Expected result
no crashing after performing an operation
Actual result
a random crash could happen
Included System Information
No response
Included Extensions Information
No response
The text was updated successfully, but these errors were encountered: