@@ -165,15 +165,31 @@ private void OnSessionEnd(object sender, SessionEndEventArgs e)
165
165
/// <returns>Test modules list</returns>
166
166
private IEnumerable < string > GetTestModules ( SessionStartEventArgs sessionStartEventArgs )
167
167
{
168
- var testModules = sessionStartEventArgs . GetPropertyValue < IEnumerable < string > > ( CoverletConstants . TestSourcesPropertyName ) ;
169
- if ( _eqtTrace . IsInfoEnabled )
168
+ try
169
+ {
170
+ IEnumerable < string > testModules = GetPropertyValueWrapper ( sessionStartEventArgs ) ;
171
+ if ( _eqtTrace . IsInfoEnabled )
172
+ {
173
+ _eqtTrace . Info ( "{0}: TestModules: '{1}'" ,
174
+ CoverletConstants . DataCollectorName ,
175
+ string . Join ( "," , testModules ?? Enumerable . Empty < string > ( ) ) ) ;
176
+ }
177
+ return testModules ;
178
+ }
179
+ catch ( MissingMethodException ex )
170
180
{
171
- _eqtTrace . Info ( "{0}: TestModules: '{1}'" ,
172
- CoverletConstants . DataCollectorName ,
173
- string . Join ( "," , testModules ?? Enumerable . Empty < string > ( ) ) ) ;
181
+ throw new MissingMethodException ( "Make sure to use .NET core SDK Version >= 2.2.300" , ex ) ;
174
182
}
183
+ }
175
184
176
- return testModules ;
185
+ /// <summary>
186
+ /// Wraps GetPropertyValue to catch possible MissingMethodException on unsupported runtime
187
+ /// </summary>
188
+ /// <param name="sessionStartEventArgs"></param>
189
+ /// <returns></returns>
190
+ private static IEnumerable < string > GetPropertyValueWrapper ( SessionStartEventArgs sessionStartEventArgs )
191
+ {
192
+ return sessionStartEventArgs . GetPropertyValue < IEnumerable < string > > ( CoverletConstants . TestSourcesPropertyName ) ;
177
193
}
178
194
}
179
195
}
0 commit comments