-
Notifications
You must be signed in to change notification settings - Fork 516
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[runtime] Call mono_unhandled_exception to raise AppDomain.UnhandledE…
…xception. (#20656) Call mono_unhandled_exception to raise AppDomain.UnhandledException when managed exceptions are unhandled. Partial fix for #15252 (for MonoVM, still pending for CoreCLR, which needs dotnet/runtime#102730 fixed first).
- Loading branch information
1 parent
1c7604c
commit a0b858a
Showing
19 changed files
with
162 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using System; | ||
using System.Runtime.InteropServices; | ||
|
||
using Foundation; | ||
|
||
namespace MySimpleApp { | ||
public class Program { | ||
static int Main (string [] args) | ||
{ | ||
GC.KeepAlive (typeof (NSObject)); // prevent linking away the platform assembly | ||
|
||
var testCaseString = Environment.GetEnvironmentVariable ("EXCEPTIONAL_TEST_CASE"); | ||
if (string.IsNullOrEmpty (testCaseString)) { | ||
Console.WriteLine ($"The environment variable EXCEPTIONAL_TEST_CASE wasn't set."); | ||
return 2; | ||
} | ||
var testCase = int.Parse (testCaseString); | ||
switch (testCase) { | ||
case 1: | ||
AppDomain.CurrentDomain.UnhandledException += (object sender, UnhandledExceptionEventArgs e) => { | ||
if (e.ExceptionObject is TestCaseException) { | ||
Console.WriteLine (Environment.GetEnvironmentVariable ("MAGIC_WORD")); | ||
} else { | ||
Console.WriteLine ($"Unexpected exception type: {e.ExceptionObject?.GetType ()}"); | ||
} | ||
Environment.Exit (0); | ||
}; | ||
throw new TestCaseException (); | ||
default: | ||
Console.WriteLine ($"Unknown test case: {testCase}"); | ||
return 3; | ||
} | ||
|
||
return 1; | ||
} | ||
} | ||
} | ||
|
||
class TestCaseException : Exception { | ||
public TestCaseException () | ||
: base ("Testing, testing") | ||
{ | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
tests/dotnet/ExceptionalTestApp/MacCatalyst/ExceptionalTestApp.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<TargetFramework>net$(BundledNETCoreAppTargetFrameworkVersion)-maccatalyst</TargetFramework> | ||
</PropertyGroup> | ||
<Import Project="..\shared.csproj" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include ../shared.mk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
TOP=../../.. | ||
include $(TOP)/tests/common/shared-dotnet-test.mk |
7 changes: 7 additions & 0 deletions
7
tests/dotnet/ExceptionalTestApp/iOS/ExceptionalTestApp.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<TargetFramework>net$(BundledNETCoreAppTargetFrameworkVersion)-ios</TargetFramework> | ||
</PropertyGroup> | ||
<Import Project="..\shared.csproj" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include ../shared.mk |
7 changes: 7 additions & 0 deletions
7
tests/dotnet/ExceptionalTestApp/macOS/ExceptionalTestApp.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<TargetFramework>net$(BundledNETCoreAppTargetFrameworkVersion)-macos</TargetFramework> | ||
</PropertyGroup> | ||
<Import Project="..\shared.csproj" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include ../shared.mk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project> | ||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
|
||
<ApplicationTitle>ExceptionalTestApp</ApplicationTitle> | ||
<ApplicationId>com.xamarin.exceptionaltestapp</ApplicationId> | ||
</PropertyGroup> | ||
|
||
<Import Project="../../common/shared-dotnet.csproj" /> | ||
|
||
<ItemGroup> | ||
<Compile Include="../*.cs" /> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
TOP=../../../.. | ||
TESTNAME=MySimpleApp | ||
include $(TOP)/tests/common/shared-dotnet.mk |
7 changes: 7 additions & 0 deletions
7
tests/dotnet/ExceptionalTestApp/tvOS/ExceptionalTestApp.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<TargetFramework>net$(BundledNETCoreAppTargetFrameworkVersion)-tvos</TargetFramework> | ||
</PropertyGroup> | ||
<Import Project="..\shared.csproj" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include ../shared.mk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters