Skip to content

Commit

Permalink
Add another handler
Browse files Browse the repository at this point in the history
  • Loading branch information
CyrusNajmabadi committed Oct 16, 2023
1 parent 50f4112 commit b4d1fab
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Compilers/Core/Portable/InternalUtilities/FatalError.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ public static void CopyHandlersTo(Assembly assembly)
static void copyHandlerTo(Assembly assembly, ErrorReporterHandler? handler, string handlerName)
{
var targetType = assembly.GetType(typeof(FatalError).FullName!, throwOnError: true)!;
var targetHandlerProperty = targetType.GetProperty(handlerName, BindingFlags.Static | BindingFlags.NonPublic)!;
var targetHandlerProperty = targetType.GetField(handlerName, BindingFlags.Static | BindingFlags.NonPublic)!;
if (handler is not null)
{
// We need to convert the delegate type to the type in the linked copy since they won't have identity.
var convertedDelegate = Delegate.CreateDelegate(targetHandlerProperty.PropertyType, handler.Target, handler.Method);
var convertedDelegate = Delegate.CreateDelegate(targetHandlerProperty.FieldType, handler.Target, handler.Method);
targetHandlerProperty.SetValue(obj: null, value: convertedDelegate);
}
else
Expand Down

0 comments on commit b4d1fab

Please sign in to comment.