Repository: PowerShell/PowerShell
File: src/System.Management.Automation/engine/runtime/Binding/Binders.cs (C#)

Code before:
                    "MethodNotFound", ParserStrings.MethodNotFound, ParserOps.GetTypeFullName(value), memberName);
            }

            return true;
        }

        internal static void InvalidateCache()
        {
            // Invalidate regular binders
            lock (s_binderCache)
            {
                foreach (PSInvokeMemberBinder binder in s_binderCache.Values)
                {
                    binder._getMemberBinder._version += 1;
                }
            }
        }

        private static Expression AddMemberInvocationLogging(
            Expression expr,
            string targetName,
            string name,
            List<Expression> args)
        {
#if UNIX
            // For efficiency this is a no-op on non-Windows platforms.
            return expr;
#else
            Expression[] invocationArgs = new Expression[args.Count];
            for (int i = 0; i < args.Count; i++)
            {
                invocationArgs[i] = args[i].Cast(typeof(object));
            }

            return Expression.Block(
                Expression.Call(
                    CachedReflectionInfo.MemberInvocationLoggingOps_LogMemberInvocation,
                    Expression.Constant(targetName),
                    Expression.Constant(name),
                    Expression.NewArrayInit(typeof(object), invocationArgs)),
                expr);
#endif
        }

        private static void AddMemberInvocationLogging(
            List<Expression> exprs,
            string targetName,
            string name,
            List<Expression> args)
        {
#if !UNIX

Review comment (bug):
Is there a reason why you've removed the `!DEBUG` and `#nullable enable` code? I would have assumed that we would still want to be able to debug this code on all platforms in a debug build using the console output for non-Windows.

Code after:
                    "MethodNotFound", ParserStrings.MethodNotFound, ParserOps.GetTypeFullName(value), memberName);
            }

            return true;
        }

        internal static void InvalidateCache()
        {
            // Invalidate regular binders
            lock (s_binderCache)
            {
                foreach (PSInvokeMemberBinder binder in s_binderCache.Values)
                {
                    binder._getMemberBinder._version += 1;
                }
            }
        }

#nullable enable
        private static Expression AddMemberInvocationLogging(
            Expression expr,
            string targetName,
            string name,
            List<Expression> args)
        {
#if UNIX
            // For efficiency this is a no-op on non-Windows platforms.
            return expr;
#else
            Expression[] invocationArgs = new Expression[args.Count];
            for (int i = 0; i < args.Count; i++)
            {
                invocationArgs[i] = args[i].Cast(typeof(object));
            }

            return Expression.Block(
                Expression.Call(
                    CachedReflectionInfo.MemberInvocationLoggingOps_LogMemberInvocation,
                    Expression.Constant(targetName),
                    Expression.Constant(name),
                    Expression.NewArrayInit(typeof(object), invocationArgs)),
                expr);
#endif
        }

        private static void AddMemberInvocationLogging(
            List<Expression> exprs,
            string targetName,
            string name,
            List<Expression> args)
        {