From 99806507575bd7847fa366ac0875396bdadc6884 Mon Sep 17 00:00:00 2001 From: Jackson Schuster <36744439+jtschuster@users.noreply.github.com> Date: Thu, 23 May 2024 08:50:59 -0700 Subject: [PATCH 1/2] Allow non-IMemberDefinition sources to be origin for event methods --- src/tools/illink/src/linker/Linker.Steps/MarkStep.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/tools/illink/src/linker/Linker.Steps/MarkStep.cs b/src/tools/illink/src/linker/Linker.Steps/MarkStep.cs index 7224e401c3e0c..d57a5f60c2dae 100644 --- a/src/tools/illink/src/linker/Linker.Steps/MarkStep.cs +++ b/src/tools/illink/src/linker/Linker.Steps/MarkStep.cs @@ -3508,9 +3508,7 @@ protected internal void MarkProperty (PropertyDefinition prop, in DependencyInfo protected internal virtual void MarkEvent (EventDefinition evt, in DependencyInfo reason, MessageOrigin origin) { - Debug.Assert (reason.Source is IMemberDefinition or null); - // Use reason as the origin for the event methods unless it's from a descriptor - origin = reason.Source is null ? origin : new MessageOrigin ((IMemberDefinition)reason.Source); + origin = reason.Source is IMemberDefinition ? new MessageOrigin((IMemberDefinition)reason.Source) : origin; DependencyKind dependencyKind = DependencyKind.EventMethod; MarkMethodIfNotNull (evt.AddMethod, new DependencyInfo (dependencyKind, evt), origin); From 1fe6a8513f2bc861ae6b9dbe0630f0fcdf02f1df Mon Sep 17 00:00:00 2001 From: Jackson Schuster <36744439+jtschuster@users.noreply.github.com> Date: Thu, 23 May 2024 10:17:43 -0700 Subject: [PATCH 2/2] Update src/tools/illink/src/linker/Linker.Steps/MarkStep.cs Co-authored-by: Sven Boemer --- src/tools/illink/src/linker/Linker.Steps/MarkStep.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/illink/src/linker/Linker.Steps/MarkStep.cs b/src/tools/illink/src/linker/Linker.Steps/MarkStep.cs index d57a5f60c2dae..d6cc0630a65d5 100644 --- a/src/tools/illink/src/linker/Linker.Steps/MarkStep.cs +++ b/src/tools/illink/src/linker/Linker.Steps/MarkStep.cs @@ -3508,7 +3508,7 @@ protected internal void MarkProperty (PropertyDefinition prop, in DependencyInfo protected internal virtual void MarkEvent (EventDefinition evt, in DependencyInfo reason, MessageOrigin origin) { - origin = reason.Source is IMemberDefinition ? new MessageOrigin((IMemberDefinition)reason.Source) : origin; + origin = reason.Source is IMemberDefinition member ? new MessageOrigin (member) : origin; DependencyKind dependencyKind = DependencyKind.EventMethod; MarkMethodIfNotNull (evt.AddMethod, new DependencyInfo (dependencyKind, evt), origin);