File tree Expand file tree Collapse file tree 2 files changed +18
-3
lines changed
Visual Studio Solution Secrets Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -385,7 +385,22 @@ static async Task PullSecrets(PullSecrectsOptions options)
385385 continue ;
386386 }
387387
388- var secretFiles = JsonSerializer . Deserialize < Dictionary < string , string > > ( file . content ) ;
388+ Dictionary < string , string > ? secretFiles = null ;
389+ try
390+ {
391+ secretFiles = JsonSerializer . Deserialize < Dictionary < string , string > > ( file . content ) ;
392+ }
393+ catch
394+ {
395+ Console . Write ( $ "\n ERR: File content cannot be read: { file . name } ") ;
396+ }
397+
398+ if ( secretFiles == null )
399+ {
400+ failed = true ;
401+ break ;
402+ }
403+
389404 foreach ( var secret in secretFiles )
390405 {
391406 string configFileName = secret . Key ;
Original file line number Diff line number Diff line change @@ -77,7 +77,7 @@ public ICollection<ConfigFile> GetProjectsSecretConfigFile()
7777 }
7878
7979 var secrects = GetProjectSecretsFilePath ( projectFileContent ) ;
80- if ( secrects == null )
80+ if ( secrects == null && projectFile . Directory != null )
8181 {
8282 secrects = GetDotNetFrameworkProjectSecretFiles ( projectFileContent , projectFile . Directory ) ;
8383 }
@@ -186,7 +186,7 @@ public void SaveConfigFile(ConfigFile configFile)
186186 string filePath = GetSecretsFilePath ( secretsId , userProfileFolder , configFile . FileName ) ;
187187
188188 FileInfo fileInfo = new FileInfo ( filePath ) ;
189- if ( ! fileInfo . Directory . Exists )
189+ if ( fileInfo . Directory != null && ! fileInfo . Directory . Exists )
190190 {
191191 Directory . CreateDirectory ( fileInfo . Directory . FullName ) ;
192192 }
You can’t perform that action at this time.
0 commit comments