@@ -53,7 +53,6 @@ public void Prepare()
5353 downloadTask . Value = 100 ;
5454 }
5555 }
56-
5756 public void Commit ( )
5857 {
5958 Commit ( GetExistingSdkVersions ( _request . InstallRoot ) ) ;
@@ -63,22 +62,13 @@ public void Commit(IEnumerable<ReleaseVersion> existingSdkVersions)
6362 {
6463 using var activity = InstallationActivitySource . ActivitySource . StartActivity ( "DotnetInstaller.Commit" ) ;
6564
66- if ( _archivePath == null || ! File . Exists ( _archivePath ) )
67- {
68- throw new InvalidOperationException ( "Archive not found. Make sure Prepare() was called successfully." ) ;
69- }
7065
7166 using ( var progressReporter = _progressTarget . CreateProgressReporter ( ) )
7267 {
7368 var installTask = progressReporter . AddTask ( $ "Installing .NET SDK { _resolvedVersion } ", maxValue : 100 ) ;
7469
7570 // Extract archive directly to target directory with special handling for muxer
76- var extractResult = ExtractArchiveDirectlyToTarget ( _archivePath , _request . InstallRoot . Path ! , existingSdkVersions , installTask ) ;
77- if ( extractResult is not null )
78- {
79- throw new InvalidOperationException ( $ "Failed to install SDK: { extractResult } ") ;
80- }
81-
71+ ExtractArchiveDirectlyToTarget ( _archivePath ! , _request . InstallRoot . Path ! , existingSdkVersions , installTask ) ;
8272 installTask . Value = installTask . MaxValue ;
8373 }
8474 }
@@ -89,25 +79,17 @@ public void Commit(IEnumerable<ReleaseVersion> existingSdkVersions)
8979 */
9080 private string ? ExtractArchiveDirectlyToTarget ( string archivePath , string targetDir , IEnumerable < ReleaseVersion > existingSdkVersions , IProgressTask ? installTask )
9181 {
92- try
93- {
94- // Ensure target directory exists
95- Directory . CreateDirectory ( targetDir ) ;
82+ Directory . CreateDirectory ( targetDir ) ;
9683
97- var muxerConfig = ConfigureMuxerHandling ( existingSdkVersions ) ;
84+ var muxerConfig = ConfigureMuxerHandling ( existingSdkVersions ) ;
9885
99- if ( ! RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) )
100- {
101- return ExtractTarArchive ( archivePath , targetDir , muxerConfig , installTask ) ;
102- }
103- else
104- {
105- return ExtractZipArchive ( archivePath , targetDir , muxerConfig , installTask ) ;
106- }
86+ if ( ! RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) )
87+ {
88+ return ExtractTarArchive ( archivePath , targetDir , muxerConfig , installTask ) ;
10789 }
108- catch ( Exception e )
90+ else
10991 {
110- return e . Message ;
92+ return ExtractZipArchive ( archivePath , targetDir , muxerConfig , installTask ) ;
11193 }
11294 }
11395
@@ -116,6 +98,7 @@ public void Commit(IEnumerable<ReleaseVersion> existingSdkVersions)
11698 */
11799 private MuxerHandlingConfig ConfigureMuxerHandling ( IEnumerable < ReleaseVersion > existingSdkVersions )
118100 {
101+ // TODO: This is very wrong - its comparing a runtime version and sdk version, plus it needs to respect the muxer version
119102 ReleaseVersion ? existingMuxerVersion = existingSdkVersions . Any ( ) ? existingSdkVersions . Max ( ) : ( ReleaseVersion ? ) null ;
120103 ReleaseVersion newRuntimeVersion = _resolvedVersion ;
121104 bool shouldUpdateMuxer = existingMuxerVersion is null || newRuntimeVersion . CompareTo ( existingMuxerVersion ) > 0 ;
0 commit comments