{"record":{"id":"16a9288f0305fa52","repo":"dotnet/wpf","slug":"0x80041702","errorCode":"0x80041702","errorMessage":"GetValue was already called on current chunk.","messagePattern":"GetValue was already called on current chunk\\.","errorType":"error_code","errorClass":"COMException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/IO/Packaging/CorePropertiesFilter.cs","lineNumber":143,"sourceCode":"        /// <returns></returns>\n        /// <remarks>Not supported in indexing of core properties.</remarks>\n        public string GetText(int bufferCharacterCount)\n        {\n            throw new COMException(SR.FilterGetTextNotSupported,\n                (int)FilterErrorCode.FILTER_E_NO_TEXT);\n        }\n\n        /// <summary>\n        /// Gets the property value corresponding to current chunk.\n        /// </summary>\n        /// <returns>Property value</returns>\n        public object GetValue()\n        {\n            // If GetValue() is already called for current chunk,\n            // return error with FILTER_E_NO_MORE_VALUES.\n            if (!_pendingGetValue)\n            {\n                throw new COMException(SR.FilterGetValueAlreadyCalledOnCurrentChunk,\n                    (int)FilterErrorCode.FILTER_E_NO_MORE_VALUES);\n            }\n\n            // No GetValue() call pending from this point on\n            // until another call to GetChunk() is made successfully.\n            _pendingGetValue = false;\n\n            return CorePropertyEnumerator.CurrentValue;\n        }\n\n        #endregion IManagedFilter methods\n\n        #region Private methods\n\n        /// <summary>\n        /// Generates unique and legal chunk ID.\n        /// To be called prior to returning a chunk.\n        /// </summary>","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/dotnet/wpf/blob/81131a70a4c573cd62748a5c36908fc4d662daa9/src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/IO/Packaging/CorePropertiesFilter.cs#L125-L161","documentation":"CorePropertiesFilter returns at most one property value per chunk, tracked by the _pendingGetValue flag. A second GetValue() call on the same chunk (before a new successful GetChunk) throws a COMException with FILTER_E_NO_MORE_VALUES (0x80041702), per IFilter protocol.","triggerScenarios":"Calling GetValue() twice on the current chunk without an intervening GetChunk() call.","commonSituations":"Looping 'while true { GetValue() }' expecting multiple values per chunk; retry logic that re-calls GetValue after a partial failure; misunderstanding the IFilter one-value-per-chunk contract.","solutions":["Call GetValue() at most once per chunk; call GetChunk() to advance before the next GetValue().","Model the loop as: GetChunk -> if value chunk, GetValue once -> repeat.","Catch COMException with HResult 0x80041702 and treat it as end-of-values for the current chunk."],"exampleFix":"// before\nobject v1 = filter.GetValue();\nobject v2 = filter.GetValue(); // throws\n// after\nobject v1 = filter.GetValue();\nif (filter.GetChunk() == FILTER_E_END_OF_CHUNKS) break;\nobject v2 = filter.GetValue();","handlingStrategy":"validation","validationCode":"bool valuePending = true; // set true after GetChunk, set false after first GetValue\nif (!valuePending) throw new InvalidOperationException(\"GetValue already consumed for this chunk\");","typeGuard":null,"tryCatchPattern":"try { value = filter.GetValue(); pending = false; } catch (COMException ex) when (ex.HResult == unchecked((int)0x80041702)) { /* already consumed: call GetChunk next */ }","preventionTips":["Track pending-GetValue state per chunk in your filter host","Always call GetChunk between GetValue calls","Loop on GetChunk, never on GetValue"],"tags":["com","ifilter","indexing","protocol-violation"],"backgroundTag":"invalid-state-transition","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"}