{"record":{"id":"30b674b1e67885bd","repo":"AvaloniaUI/Avalonia","slug":"the-methodaccessorplugin-does-not-support-dynamic","errorCode":null,"errorMessage":"The MethodAccessorPlugin does not support dynamic matching","messagePattern":"The MethodAccessorPlugin does not support dynamic matching","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Avalonia.Base/Data/Core/Plugins/MethodAccessorPlugin.cs","lineNumber":20,"sourceCode":"using System.Diagnostics;\nusing System.Reflection;\n\nnamespace Avalonia.Data.Core.Plugins;\n\ninternal class MethodAccessorPlugin : IPropertyAccessorPlugin\n{\n    private readonly MethodInfo _method;\n    private readonly Type _delegateType;\n\n    public MethodAccessorPlugin(MethodInfo method, Type delegateType)\n    {\n        _method = method;\n        _delegateType = delegateType;\n    }\n\n    public bool Match(object obj, string propertyName)\n    {\n        throw new InvalidOperationException(\"The MethodAccessorPlugin does not support dynamic matching\");\n    }\n\n    public IPropertyAccessor Start(WeakReference<object?> reference, string propertyName)\n    {\n        Debug.Assert(_method.Name == propertyName);\n        return new Accessor(reference, _method, _delegateType);\n    }\n\n    private sealed class Accessor : PropertyAccessorBase\n    {\n        public Accessor(WeakReference<object?> reference, MethodInfo method, Type delegateType)\n        {\n            _ = reference ?? throw new ArgumentNullException(nameof(reference));\n            _ = method ?? throw new ArgumentNullException(nameof(method));\n\n            PropertyType = delegateType;\n\n            if (method.IsStatic)","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/AvaloniaUI/Avalonia/blob/11c542726898ae954a1ef668c65ec79ec92ab17d/src/Avalonia.Base/Data/Core/Plugins/MethodAccessorPlugin.cs#L2-L38","documentation":"MethodAccessorPlugin exposes a known MethodInfo as a delegate for compiled bindings. The IPropertyAccessorPlugin.Match method (used by the reflection-binding accessor pipeline to pick a plugin by object+name) throws InvalidOperationException because this plugin cannot match dynamically — it only works with a pre-supplied MethodInfo. Hitting it means the plugin was incorrectly placed in the reflection accessor chain.","triggerScenarios":"Registering MethodAccessorPlugin in the property accessor plugin list (e.g. Data.Core.Accessor.PluginHandlers / a custom chain) and then resolving a reflection (string) binding that probes Match on each plugin.","commonSituations":"Misconfiguring the accessor plugin pipeline; third-party code mixing compiled-binding plugins into the reflection binding path; manual instantiation and use of MethodAccessorPlugin.","solutions":["Do not add MethodAccessorPlugin to the reflection accessor chain; it is for compiled bindings only.","Use InpcPropertyAccessorPlugin for reflection bindings against CLR objects.","Keep the compiled-binding plugin set separate from the reflection-binding plugin set."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Never place compiled-binding-only plugins in the reflection accessor chain.\n// When building the plugin list, filter them out:\nplugins = plugins.Where(p => p is not MethodAccessorPlugin).ToList();","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep compiled-binding accessor plugins (MethodAccessorPlugin, PropertyInfoAccessorPlugin) out of the reflection-binding plugin chain.","Use InpcPropertyAccessorPlugin for reflection bindings on CLR objects.","Document which plugins support Match and which do not."],"tags":["binding","accessor-plugin","compiled-binding","configuration"],"backgroundTag":null,"analyzedSha":"11c542726898ae954a1ef668c65ec79ec92ab17d","analyzedAt":"2026-08-13T11:57:40.261Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}