{"record":{"id":"9273393c46f5af2e","repo":"dotnet/wpf","slug":"sr-effect-no-inputsource","errorCode":null,"errorMessage":"SR.Effect_No_InputSource","messagePattern":"SR\\.Effect_No_InputSource","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/Effects/BitmapEffect.cs","lineNumber":97,"sourceCode":"                 SafeHandle/* IMILBitmapEffectPrimitive */ innerObject)\n        {\n        }\n\n        #endregion\n\n        #region Public Methods\n        /// <summary>\n        /// This returns the output at index 0\n        /// </summary>\n        [Obsolete(MS.Internal.Media.VisualTreeUtils.BitmapEffectObsoleteMessage)]\n        public BitmapSource GetOutput(BitmapEffectInput input)\n        {\n            ArgumentNullException.ThrowIfNull(input);\n\n            // if we don't have the input set, we should not be calling the output property\n            if (input.Input == null)\n            {\n                throw new ArgumentException(SR.Effect_No_InputSource, nameof(input));\n            }\n\n            if (input.Input == BitmapEffectInput.ContextInputSource)\n            {\n                throw new InvalidOperationException(SR.Format(SR.Effect_No_ContextInputSource, null));\n            }\n\n            return input.Input.Clone();\n        }\n        #endregion\n\n        #region Internal Methods\n\n        /// <summary>\n        /// True if the effect can be emulated by the Effect pipeline. Derived classes \n        /// can override this method to indicate that they can be emulated using the ImageEffect\n        /// pipeline. If a derived class returns true it needs to also implement the GetEmulatingImageEffect\n        /// property to provide an emulating ImageEffect.","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/Effects/BitmapEffect.cs#L79-L115","documentation":"BitmapEffect.GetOutput(input) was called with a BitmapEffectInput whose Input property is null — no source bitmap was set. The method first null-checks the argument itself, then checks input.Input; when the source was never assigned it throws ArgumentException with SR.Effect_No_InputSource for the 'input' parameter.","triggerScenarios":"Calling GetOutput(new BitmapEffectInput()) or with an input created without setting .Input; reading Output before assigning the effect's Input in a render pipeline.","commonSituations":"Custom effect evaluation code that forgot Input assignment; data-binding that failed to deliver the source; reordering code so GetOutput runs before Input is set.","solutions":["Set input.Input to a BitmapSource before calling GetOutput","Validate input.Input != null before invoking GetOutput","Check why the bound/assigned source is null (binding errors, failed image load)","If 'use the whole visual context' was intended, read the context source instead of leaving Input unset"],"exampleFix":"// before\nvar input = new BitmapEffectInput();\nvar output = effect.GetOutput(input); // throws: Input not set\n\n// after\nvar input = new BitmapEffectInput { Input = sourceBitmap };\nvar output = effect.GetOutput(input);","handlingStrategy":"validation","validationCode":"if (input == null) throw new ArgumentNullException(nameof(input));\nif (input.Input == null)\n    throw new ArgumentException(\"BitmapEffectInput.Input must be set before GetOutput\", nameof(input));\nvar output = effect.GetOutput(input);","typeGuard":null,"tryCatchPattern":"try { var output = effect.GetOutput(input); }\ncatch (ArgumentException ex) when (ex.ParamName == \"input\")\n{\n    // assign a real source and retry\n}","preventionTips":["Always assign BitmapEffectInput.Input before evaluating output","Verify data bindings that supply the source resolved to a non-null value","Centralize input construction so the source is never omitted"],"tags":["wpf","bitmapeffect","argument","missing-input"],"backgroundTag":"missing-required-argument","analyzedSha":"81131a70a4c573cd62748a5c36908fc4d662daa9","analyzedAt":"2026-09-14T10:12:48.479Z","contentChangedAt":"2026-09-14T10:12:48.479Z","schemaVersion":2},"datasetVersion":"2026-09-21T21:30:21.729Z"}