Skip to content

Commit ed41478

Browse files
[release/6.0] [mono] Preserve FirstChanceExceptionEventArgs ctor (#68265)
* [mono] Preserve FirstChanceExceptionEventArgs ctor The runtime is creating the exception so we need to preserve it. See dotnet/android#6626 * PR feedback: use DynamicDependencyAttribute instead Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
1 parent 39dbeee commit ed41478

File tree

4 files changed

+4
-6
lines changed

4 files changed

+4
-6
lines changed

src/libraries/System.Private.CoreLib/src/System.Private.CoreLib.Shared.projitems

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,7 @@
761761
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\ConstrainedExecution\PrePrepareMethodAttribute.cs" />
762762
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\ConstrainedExecution\ReliabilityContractAttribute.cs" />
763763
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\ExceptionServices\ExceptionDispatchInfo.cs" />
764-
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\ExceptionServices\ExceptionNotification.cs" />
764+
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\ExceptionServices\FirstChanceExceptionEventArgs.cs" />
765765
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\ExceptionServices\HandleProcessCorruptedStateExceptionsAttribute.cs" />
766766
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\GCSettings.cs" />
767767
<Compile Include="$(MSBuildThisFileDirectory)System\Runtime\InteropServices\AllowReversePInvokeCallsAttribute.cs" />

src/libraries/System.Private.CoreLib/src/System/AppContext.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
using System.Collections.Generic;
55
using System.Diagnostics;
6+
using System.Diagnostics.CodeAnalysis;
67
using System.Diagnostics.Tracing;
78
using System.Reflection;
89
using System.Runtime.ExceptionServices;
@@ -62,8 +63,10 @@ public static void SetData(string name, object? data)
6263
}
6364

6465
#pragma warning disable CS0067 // events raised by the VM
66+
[field: DynamicDependency(DynamicallyAccessedMemberTypes.PublicConstructors, typeof(UnhandledExceptionEventArgs))]
6567
public static event UnhandledExceptionEventHandler? UnhandledException;
6668

69+
[field: DynamicDependency(DynamicallyAccessedMemberTypes.PublicConstructors, typeof(FirstChanceExceptionEventArgs))]
6770
public static event EventHandler<FirstChanceExceptionEventArgs>? FirstChanceException;
6871
#pragma warning restore CS0067
6972

src/libraries/System.Private.CoreLib/src/System/Runtime/ExceptionServices/ExceptionNotification.cs renamed to src/libraries/System.Private.CoreLib/src/System/Runtime/ExceptionServices/FirstChanceExceptionEventArgs.cs

File renamed without changes.

src/mono/System.Private.CoreLib/src/ILLink/ILLink.Descriptors.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -412,11 +412,6 @@
412412
<field name="_value"/>
413413
</type>
414414

415-
<!-- object.c: create_unhandled_exception_eventargs (assert) -->
416-
<type fullname="System.UnhandledExceptionEventArgs">
417-
<method signature="System.Void .ctor(System.Object,System.Boolean)" />
418-
</type>
419-
420415
<!-- class.c: make_generic_param_class -->
421416
<type fullname="System.ValueType" preserve="nothing" />
422417

0 commit comments

Comments
 (0)