{"record":{"id":"aae350b77f8458ba","repo":"AvaloniaUI/Avalonia","slug":"updatesourcetrigger-cannot-be-default","errorCode":null,"errorMessage":"UpdateSourceTrigger cannot be Default.","messagePattern":"UpdateSourceTrigger cannot be Default\\.","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Avalonia.Base/Data/Core/BindingExpression.cs","lineNumber":82,"sourceCode":"        object? fallbackValue,\n        TimeSpan delay = default,\n        IValueConverter? converter = null,\n        CultureInfo? converterCulture = null,\n        object? converterParameter = null,\n        bool enableDataValidation = false,\n        BindingMode mode = BindingMode.OneWay,\n        BindingPriority priority = BindingPriority.LocalValue,\n        string? stringFormat = null,\n        object? targetNullValue = null,\n        AvaloniaProperty? targetProperty = null,\n        TargetTypeConverter? targetTypeConverter = null,\n        UpdateSourceTrigger updateSourceTrigger = UpdateSourceTrigger.PropertyChanged)\n            : base(priority, targetProperty, enableDataValidation)\n    {\n        if (mode == BindingMode.Default)\n            throw new ArgumentException(\"Binding mode cannot be Default.\", nameof(mode));\n        if (updateSourceTrigger == UpdateSourceTrigger.Default)\n            throw new ArgumentException(\"UpdateSourceTrigger cannot be Default.\", nameof(updateSourceTrigger));\n\n        if (source == AvaloniaProperty.UnsetValue)\n            source = null;\n\n        _source = new(source);\n        _mode = mode;\n        _nodes = nodes ?? s_emptyExpressionNodes;\n        _targetTypeConverter = targetTypeConverter;\n        _shouldUpdateOneTimeBindingTarget = _mode == BindingMode.OneTime;\n\n        if (delay != default ||\n            converter is not null ||\n            converterCulture is not null ||\n            converterParameter is not null ||\n            fallbackValue != AvaloniaProperty.UnsetValue ||\n            !string.IsNullOrWhiteSpace(stringFormat) ||\n            (targetNullValue is not null && targetNullValue != AvaloniaProperty.UnsetValue) ||\n            updateSourceTrigger is not UpdateSourceTrigger.PropertyChanged)","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/AvaloniaUI/Avalonia/blob/11c542726898ae954a1ef668c65ec79ec92ab17d/src/Avalonia.Base/Data/Core/BindingExpression.cs#L64-L100","documentation":"BindingExpression's constructor requires a concrete UpdateSourceTrigger. UpdateSourceTrigger.Default is a sentinel meaning 'resolve from metadata'; it must be resolved to PropertyChanged, LostFocus, or Explicit before the expression is built. Passing Default through means the resolution step was skipped.","triggerScenarios":"Directly constructing a BindingExpression with updateSourceTrigger == UpdateSourceTrigger.Default, or a binding builder that forwards the unresolved sentinel.","commonSituations":"A custom binding wrapper or compiled-binding helper that does not run the trigger-resolution step; framework version change altering where Default is resolved.","solutions":["Resolve Default to a concrete value (typically UpdateSourceTrigger.PropertyChanged) before construction.","Pass an explicit UpdateSourceTrigger.PropertyChanged (or LostFocus/Explicit) at the call site.","Use the standard Binding object initialization path so the sentinel is resolved upstream."],"exampleFix":"// before\nvar expr = new BindingExpression(..., updateSourceTrigger: UpdateSourceTrigger.Default, ...);\n// after\nvar resolved = trigger == UpdateSourceTrigger.Default ? UpdateSourceTrigger.PropertyChanged : trigger;\nvar expr = new BindingExpression(..., updateSourceTrigger: resolved, ...);","handlingStrategy":"validation","validationCode":"// Resolve Default before constructing a BindingExpression.\nUpdateSourceTrigger ResolveTrigger(UpdateSourceTrigger t) =>\n    t == UpdateSourceTrigger.Default ? UpdateSourceTrigger.PropertyChanged : t;","typeGuard":"static bool IsConcreteTrigger(UpdateSourceTrigger t) => t != UpdateSourceTrigger.Default;","tryCatchPattern":null,"preventionTips":["Resolve UpdateSourceTrigger.Default to PropertyChanged (or LostFocus) before construction.","When wrapping Binding, use the framework's init path that resolves the sentinel."],"tags":["data-binding","update-source-trigger","validation","internal-api"],"backgroundTag":null,"analyzedSha":"11c542726898ae954a1ef668c65ec79ec92ab17d","analyzedAt":"2026-08-13T11:57:40.261Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}