Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions src/vstest.console/CommandLine/CommandLineOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -295,14 +295,10 @@ public void AddSource(string source)
// Get matching files from file pattern parser
matchingFiles = FilePatternParser.GetMatchingFiles(source);
}
catch(TestSourceException ex)
catch(TestSourceException ex) when (source.StartsWith("-") || source.StartsWith("/"))
{
if(source.StartsWith("-") || source.StartsWith("/"))
{
throw new TestSourceException(
string.Format(CultureInfo.CurrentUICulture, CommandLineResources.InvalidArgument, source));
}
throw ex;
throw new TestSourceException(
string.Format(CultureInfo.CurrentUICulture, CommandLineResources.InvalidArgument, source), ex);
}
// Add the matching files to source list
this.sources = this.sources.Union(matchingFiles).ToList();
Expand Down
12 changes: 11 additions & 1 deletion src/vstest.console/CommandLine/TestSourceException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,17 @@ public TestSourceException()
/// </summary>
/// <param name="message">Message for the exception.</param>
public TestSourceException(string message)
: base(message)
: this(message, innerException: null)
{
}

/// <summary>
/// Initializes with the message and innerException.
/// </summary>
/// <param name="message">Message for the exception.</param>
/// <param name="innerException">The exception that is the cause of the current exception, or a null reference.</param>
public TestSourceException(string message, Exception innerException)
: base(message, innerException)
{
}

Expand Down