File tree Expand file tree Collapse file tree 1 file changed +17
-12
lines changed
csharp/extractor/Semmle.Extraction.CSharp.Standalone Expand file tree Collapse file tree 1 file changed +17
-12
lines changed Original file line number Diff line number Diff line change @@ -140,33 +140,38 @@ private static IEnumerable<string> DesktopRuntimes
140
140
}
141
141
}
142
142
143
- private IEnumerable < string > GetRuntimes ( )
143
+ /// <summary>
144
+ /// Gets the .NET runtime location to use for extraction.
145
+ /// </summary>
146
+ public string GetRuntime ( bool useSelfContained )
144
147
{
148
+ if ( useSelfContained )
149
+ {
150
+ return ExecutingRuntime ;
151
+ }
152
+
145
153
// Gets the newest version of the installed runtimes.
146
154
var newestRuntimes = GetNewestRuntimes ( ) ;
147
155
148
156
// Location of the newest .NET Core Runtime.
149
157
if ( newestRuntimes . TryGetValue ( netCoreApp , out var netCoreVersion ) )
150
158
{
151
- yield return netCoreVersion . FullPath ;
159
+ return netCoreVersion . FullPath ;
152
160
}
153
161
154
162
// Location of the newest ASP.NET Core Runtime.
155
163
if ( newestRuntimes . TryGetValue ( aspNetCoreApp , out var aspNetCoreVersion ) )
156
164
{
157
- yield return aspNetCoreVersion . FullPath ;
165
+ return aspNetCoreVersion . FullPath ;
158
166
}
159
167
160
- foreach ( var r in DesktopRuntimes )
161
- yield return r ;
168
+ if ( DesktopRuntimes . Any ( ) )
169
+ {
170
+ return DesktopRuntimes . First ( ) ;
171
+ }
162
172
163
173
// A bad choice if it's the self-contained runtime distributed in codeql dist.
164
- yield return ExecutingRuntime ;
174
+ return ExecutingRuntime ;
165
175
}
166
-
167
- /// <summary>
168
- /// Gets the .NET runtime location to use for extraction
169
- /// </summary>
170
- public string GetRuntime ( bool useSelfContained ) => useSelfContained ? ExecutingRuntime : GetRuntimes ( ) . First ( ) ;
171
176
}
172
- }
177
+ }
You can’t perform that action at this time.
0 commit comments