Skip to content

Commit f148f79

Browse files
committed
Fix Mono console log parsing
1 parent 3b6cdc2 commit f148f79

File tree

2 files changed

+32
-5
lines changed

2 files changed

+32
-5
lines changed

src/tests/baseservices/exceptions/unhandled/unhandled.cs

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@ static int Main(string[] args)
4040
testProcess.CancelErrorRead();
4141

4242
int expectedExitCode;
43-
if (!OperatingSystem.IsWindows())
43+
if (TestLibrary.Utilities.IsMonoRuntime)
44+
{
45+
expectedExitCode = 1;
46+
}
47+
else if (!OperatingSystem.IsWindows())
4448
{
4549
expectedExitCode = 128 + 6;
4650
}
@@ -59,13 +63,33 @@ static int Main(string[] args)
5963
return 101;
6064
}
6165

62-
if (lines[0] != "Unhandled exception. System.Exception: Test")
66+
int exceptionStackFrameLine = 1;
67+
if (TestLibrary.Utilities.IsMonoRuntime)
6368
{
64-
Console.WriteLine("Missing Unhandled exception header");
65-
return 102;
69+
if (lines[0] != "Unhandled Exception:")
70+
{
71+
Console.WriteLine("Missing Unhandled exception header");
72+
return 102;
73+
}
74+
if (lines[1] != "System.Exception: Test")
75+
{
76+
Console.WriteLine("Missing exception type and message");
77+
return 103;
78+
}
79+
80+
exceptionStackFrameLine = 2;
81+
}
82+
else
83+
{
84+
if (lines[0] != "Unhandled exception. System.Exception: Test")
85+
{
86+
Console.WriteLine("Missing Unhandled exception header");
87+
return 102;
88+
}
89+
6690
}
6791

68-
if (!lines[1].TrimStart().StartsWith("at TestUnhandledException.Program.Main"))
92+
if (!lines[exceptionStackFrameLine].TrimStart().StartsWith("at TestUnhandledException.Program.Main"))
6993
{
7094
Console.WriteLine("Missing exception source frame");
7195
return 103;

src/tests/issues.targets

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3230,6 +3230,9 @@
32303230
</ItemGroup>
32313231

32323232
<ItemGroup Condition="'$(TargetArchitecture)' == 'wasm'">
3233+
<ExcludeList Include = "$(XunitTestBinBase)/baseservices/exceptions/unhandled/unhandled/**">
3234+
<Issue>System.Diagnostics.Process is not supported</Issue>
3235+
</ExcludeList>
32333236
<ExcludeList Include = "$(XunitTestBinBase)/tracing/eventcounter/incrementingeventcounter/**">
32343237
<Issue>System.Threading.Thread.UnsafeStart not supported</Issue>
32353238
</ExcludeList>

0 commit comments

Comments
 (0)