Skip to content

Commit 66c5ff9

Browse files
authored
Standalone app to run all samples to catch run time exceptions. (#3309)
* Run all samples. * changes. * comment temp stuff out. * Revert "comment temp stuff out." This reverts commit ad74e0fb91bad5de4a4e98b98402e9cc83b6acc0. * comment temp stuff. * cleanup. * revert. * PR feedback. * PR feedback.
1 parent 82dd186 commit 66c5ff9

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

docs/samples/Microsoft.ML.Samples/Microsoft.ML.Samples.csproj

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<TargetFramework>netcoreapp2.1</TargetFramework>
55
<OutputType>Exe</OutputType>
66
<SignAssembly>false</SignAssembly>
7+
<!--This ensures that we can never make the mistake of adding this as a friend assembly. Please don't remove.-->
78
<PublicSign>false</PublicSign>
89
<RootNamespace>Samples</RootNamespace>
910
</PropertyGroup>
+19-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,27 @@
1-
using Samples.Dynamic;
1+
using System;
2+
using System.Reflection;
23

34
namespace Microsoft.ML.Samples
45
{
5-
internal static class Program
6+
public static class Program
67
{
7-
static void Main(string[] args)
8+
public static void Main(string[] args) => RunAll();
9+
10+
internal static void RunAll()
811
{
9-
CalculateFeatureContribution.Example();
12+
int samples = 0;
13+
foreach (var type in Assembly.GetExecutingAssembly().GetTypes())
14+
{
15+
var sample = type.GetMethod("Example", BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy);
16+
17+
if(sample != null)
18+
{
19+
sample.Invoke(null, null);
20+
samples++;
21+
}
22+
}
23+
24+
Console.WriteLine("Number of samples that ran without any exception: " + samples);
1025
}
1126
}
1227
}

0 commit comments

Comments
 (0)