@@ -486,7 +486,7 @@ protected virtual async ValueTask StartDeltaPatchPreReqDownload(List<GameInstall
486486 _progressAllCountCurrent = 1 ;
487487
488488 // Start the verification routine
489- foreach ( GameInstallPackage asset in gamePackage )
489+ foreach ( GameInstallPackage asset in gamePackage . ToList ( ) )
490490 {
491491 switch ( await RunPackageVerificationRoutine ( asset , _token ! . Token ) )
492492 {
@@ -677,7 +677,7 @@ public virtual async ValueTask<int> StartPackageVerification(List<GameInstallPac
677677 _status . IsProgressAllIndetermined = false ;
678678
679679 // Iterate the asset
680- foreach ( GameInstallPackage asset in gamePackage )
680+ foreach ( GameInstallPackage asset in gamePackage . ToList ( ) )
681681 {
682682 int returnCode ;
683683
@@ -854,7 +854,7 @@ protected virtual async Task StartPackageInstallationInner(List<GameInstallPacka
854854 TryRemoveRedundantHDiffList ( ) ;
855855
856856 // Enumerate the installation package
857- foreach ( GameInstallPackage asset in gamePackage )
857+ foreach ( GameInstallPackage asset in gamePackage . ToList ( ) )
858858 {
859859 // Update the status
860860 _status . ActivityStatus =
@@ -2804,7 +2804,7 @@ protected virtual async ValueTask AddMainResourceVersionList(RegionResourceVersi
28042804 // Write to log if the package has segments (Example: Genshin Impact)
28052805 if ( package . Segments != null )
28062806 {
2807- foreach ( GameInstallPackage segment in package . Segments )
2807+ foreach ( GameInstallPackage segment in package . Segments . ToList ( ) )
28082808 {
28092809 LogWriteLine ( $ "Adding segmented package: { segment . Name } to the list (Hash: { segment . HashString } )",
28102810 LogType . Default , true ) ;
@@ -2964,7 +2964,7 @@ private async ValueTask InvokePackageDownloadRoutine(DownloadClient do
29642964 try
29652965 {
29662966 // Iterate the package list
2967- foreach ( GameInstallPackage package in packageList )
2967+ foreach ( GameInstallPackage package in packageList . ToList ( ) )
29682968 {
29692969 // If the package is segmented, then iterate and run the routine for segmented packages
29702970 if ( package . Segments != null )
0 commit comments