/* ======================================================================== * Copyright (c) 2005-2026 The OPC Foundation, Inc. All rights reserved. * OPC Foundation MIT License 1.00. See LICENSE.txt in the repository root. * ======================================================================*/ using System; namespace Opc.Ua.OneFuzz.TestTarget { /// /// Deliberately inexact callback signatures: discovery must exclude every one. /// public sealed class CallbackLookalikes { /// An instance method is not a callback. public void Instance(ReadOnlySpan input) { Reject(input); } /// An array parameter is not a span callback. public static void Array(byte[] input) { Reject(input); } /// A mutable span is not a read-only span callback. public static void Mutable(Span input) { Reject(input); } /// A non-void return is not a callback. public static int Returning(ReadOnlySpan input) { return input.Length; } /// An open generic method is not a callback. public static void Generic(ReadOnlySpan input) { throw new InvalidOperationException(typeof(T).Name + FixtureDependency.Hash(input)); } /// Two parameters are not the exact callback signature. public static void ExtraParameter(ReadOnlySpan input, int count) { Reject(input[..count]); } internal static void Internal(ReadOnlySpan input) { Reject(input); } private static void Reject(ReadOnlySpan input) { throw new InvalidOperationException("Callback lookalike was invoked: " + FixtureDependency.Hash(input)); } } internal static class HiddenCallbacks { public static void Hidden(ReadOnlySpan input) { throw new InvalidOperationException("Hidden callback was invoked: " + FixtureDependency.Hash(input)); } } }