File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
Packages/com.unity.ide.visualstudio/Editor Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -228,7 +228,24 @@ private static IEnumerable<VisualStudioInstallation> QueryVsWhere()
228228 if ( string . IsNullOrWhiteSpace ( progpath ) )
229229 return Enumerable . Empty < VisualStudioInstallation > ( ) ;
230230
231- var result = ProcessRunner . StartAndWaitForExit ( progpath , "-prerelease -format json -utf8" ) ;
231+ const string arguments = "-prerelease -format json" ;
232+
233+ // We've seen issues with json parsing in utf8 mode and with specific non-UTF code pages like 949 (Korea)
234+ // So try with utf8 first, then fallback to non utf8 in case of an issue
235+ // See https://github.com/microsoft/vswhere/issues/264
236+ try
237+ {
238+ return QueryVsWhere ( progpath , $ "{ arguments } -utf8") ;
239+ }
240+ catch
241+ {
242+ return QueryVsWhere ( progpath , $ "{ arguments } ") ;
243+ }
244+ }
245+
246+ private static IEnumerable < VisualStudioInstallation > QueryVsWhere ( string progpath , string arguments )
247+ {
248+ var result = ProcessRunner . StartAndWaitForExit ( progpath , arguments ) ;
232249
233250 if ( ! result . Success )
234251 throw new Exception ( $ "Failure while running vswhere: { result . Error } ") ;
You can’t perform that action at this time.
0 commit comments