File tree Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -143,14 +143,31 @@ public bool TryParse(string json, DependencyContainer dependencies)
143143 }
144144 }
145145
146+ private static bool TryReadAllText ( string path , ProgressMonitor progressMonitor , out string content )
147+ {
148+ try
149+ {
150+ content = File . ReadAllText ( path ) ;
151+ return true ;
152+ }
153+ catch ( Exception e )
154+ {
155+ progressMonitor . LogInfo ( $ "Failed to read assets file '{ path } ': { e . Message } ") ;
156+ content = "" ;
157+ return false ;
158+ }
159+ }
160+
146161 public static DependencyContainer GetCompilationDependencies ( ProgressMonitor progressMonitor , IEnumerable < string > assets )
147162 {
148163 var parser = new Assets ( progressMonitor ) ;
149164 var dependencies = new DependencyContainer ( ) ;
150165 assets . ForEach ( asset =>
151166 {
152- var json = File . ReadAllText ( asset ) ;
153- parser . TryParse ( json , dependencies ) ;
167+ if ( TryReadAllText ( asset , progressMonitor , out var json ) )
168+ {
169+ parser . TryParse ( json , dependencies ) ;
170+ }
154171 } ) ;
155172 return dependencies ;
156173 }
Original file line number Diff line number Diff line change @@ -128,7 +128,7 @@ public bool Exec(string execArgs)
128128 [ GeneratedRegex ( "Restored\\ s+(.+\\ .csproj)" , RegexOptions . Compiled ) ]
129129 private static partial Regex RestoredProjectRegex ( ) ;
130130
131- [ GeneratedRegex ( "[Assets\\ sfile\\ shas\\ snot\\ schanged.\\ sSkipping\\ sassets\\ sfile\\ swriting.|Writing\\ sassets\\ sfile\\ sto\\ sdisk.]\\ sPath:\\ s(.* )" , RegexOptions . Compiled ) ]
131+ [ GeneratedRegex ( "[Assets\\ sfile\\ shas\\ snot\\ schanged.\\ sSkipping\\ sassets\\ sfile\\ swriting.|Writing\\ sassets\\ sfile\\ sto\\ sdisk.]\\ sPath:\\ s(.+ )" , RegexOptions . Compiled ) ]
132132 private static partial Regex AssetsFileRegex ( ) ;
133133 }
134134}
You can’t perform that action at this time.
0 commit comments