{"record":{"id":"f61ddb0d99534e08","repo":"microsoft/ailab","slug":"no-image-to-copy","errorCode":null,"errorMessage":"no image to copy","messagePattern":"no image to copy","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"Snip-Insights/SnipInsight/AppManager.cs","lineNumber":1773,"sourceCode":"        {\n            Telemetry.ApplicationLogger.Instance.SubmitButtonClickEvent(Telemetry.EventName.CopyImageButton, Telemetry.ViewName.ActionRibbon);\n            try\n            {\n                // copy to clipboard.\n                bool success;\n                // Do Work\n                if (MainWindow.acetateLayer.HasInk())\n                {\n                    ViewModel.InkedImage = PictureConverter.GenerateSnapshot(MainWindow.contentImage, MainWindow.acetateLayer.InkCanvas);\n                    success = ClipboardManager.Copy(ViewModel.InkedImage);\n                }\n                else if (ViewModel.CapturedImage != null)\n                {\n                    success = ClipboardManager.Copy(ViewModel.CapturedImage);\n                }\n                else\n                {\n                    throw new InvalidOperationException(\"no image to copy\");\n                }\n                ToastControl toast = new ToastControl(success ? Resources.Message_CopiedToClipboard : Resources.Message_CopyToClipboardFailed);\n                toast.ShowInMainWindow();\n            }\n            catch (Exception ex)\n            {\n                Diagnostics.ReportException(ex);\n            }\n            finally\n            {\n                // Trigger\n                ViewModel.StateMachine.Fire(SnipInsightTrigger.CopyingWithImageCompleted);\n            }\n        }\n        #endregion\n\n        #region Events\n        void OnLoaded(object sender, RoutedEventArgs e)","sourceCodeStart":1755,"sourceCodeEnd":1791,"githubUrl":"https://github.com/microsoft/ailab/blob/89fe2fc62081145ec5408d42059cbcb7c4a033c8/Snip-Insights/SnipInsight/AppManager.cs#L1755-L1791","documentation":"The Copy command logs the CopyImageButton event and then attempts to put the current image on the clipboard; this error is the sentinel failure when there is no image data to copy. It fires when the acetate layer has no ink (so no InkedImage can be snapshotted) and no CapturedImage exists either — the user invoked Copy before capturing or annotating anything.","triggerScenarios":"Thrown at Snip-Insights/SnipInsight/AppManager.cs:1773 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check MainWindow.acetateLayer.HasInk() and ViewModel.CapturedImage before invoking the copy logic and show a friendly message when both are empty","Disable the Copy button in the ActionRibbon until an image is available","Ensure PictureConverter.GenerateSnapshot produced a non-null image before calling ClipboardManager.Copy"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"89fe2fc62081145ec5408d42059cbcb7c4a033c8","analyzedAt":"2026-09-13T20:10:53.835Z","contentChangedAt":"2026-09-13T20:10:53.835Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}