From b130feed9f6be735fee2436718ea91c9b0f22c14 Mon Sep 17 00:00:00 2001 From: Corniel Nobel Date: Wed, 27 Mar 2024 20:09:51 +0100 Subject: [PATCH] Drop `BuildEventArgsReaderProxy` (#258) --- .../Logging/BuildEventArgsReaderProxy.cs | 33 ------------------- 1 file changed, 33 deletions(-) delete mode 100644 src/Buildalyzer/Logging/BuildEventArgsReaderProxy.cs diff --git a/src/Buildalyzer/Logging/BuildEventArgsReaderProxy.cs b/src/Buildalyzer/Logging/BuildEventArgsReaderProxy.cs deleted file mode 100644 index ed121035..00000000 --- a/src/Buildalyzer/Logging/BuildEventArgsReaderProxy.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; -using System.IO; -using System.Reflection; -using Microsoft.Build.Framework; -using Microsoft.Build.Logging; - -namespace Buildalyzer.Logging; - -internal class BuildEventArgsReaderProxy -{ - private readonly Func _read; - - public BuildEventArgsReaderProxy(BinaryReader reader) - { - // Use reflection to get the Microsoft.Build.Logging.BuildEventArgsReader.Read() method - object argsReader; - Type buildEventArgsReader = typeof(BinaryLogger).GetTypeInfo().Assembly.GetType("Microsoft.Build.Logging.BuildEventArgsReader"); - ConstructorInfo readerCtor = buildEventArgsReader.GetConstructor(new[] { typeof(BinaryReader) }); - if (readerCtor != null) - { - argsReader = readerCtor.Invoke(new[] { reader }); - } - else - { - readerCtor = buildEventArgsReader.GetConstructor(new[] { typeof(BinaryReader), typeof(int) }); - argsReader = readerCtor.Invoke(new object[] { reader, 7 }); - } - MethodInfo readMethod = buildEventArgsReader.GetMethod("Read"); - _read = (Func)readMethod.CreateDelegate(typeof(Func), argsReader); - } - - public BuildEventArgs Read() => _read(); -}