diff --git a/docs/fundamentals/code-analysis/quality-rules/ca1806.md b/docs/fundamentals/code-analysis/quality-rules/ca1806.md index cb34fc9d91d65..91163cad653d8 100644 --- a/docs/fundamentals/code-analysis/quality-rules/ca1806.md +++ b/docs/fundamentals/code-analysis/quality-rules/ca1806.md @@ -1,7 +1,7 @@ --- title: "CA1806: Do not ignore method results (code analysis)" description: "Learn about code analysis rule CA1806: Do not ignore method results" -ms.date: 06/08/2022 +ms.date: 10/30/2025 f1_keywords: - CA1806 - DoNotIgnoreMethodResults @@ -32,6 +32,7 @@ There are several possible reasons for this warning: - A method that creates and returns a new string is called and the new string is never used. - A COM or P/Invoke method returns a `HRESULT` or error code that's never used. - A language-integrated query (LINQ) method returns a result that's never used. +- A `[Pure]` method is called and the return value is never used. ## Rule description @@ -41,7 +42,7 @@ Strings are immutable and methods such as are known to not have side effects, and the result should not be ignored. ## How to fix violations @@ -57,7 +58,7 @@ If method A calls method B but does not use the `HRESULT` or error code that the -or- -If a LINQ method A calls method B but does not use the result, use the result in a conditional statement, assign the result to a variable, or pass it as an argument to another method. +If method A calls a LINQ or pure method B but does not use the result, use the result in a conditional statement, assign the result to a variable, or pass it as an argument to another method. ## When to suppress warnings @@ -122,7 +123,7 @@ The following example fixes the violation by assigning the result of [!NOTE] -> This violation cannot be reproduced in Visual Basic. +> This violation can't be reproduced in Visual Basic. :::code language="csharp" source="snippets/csharp/all-rules/ca1806.cs" id="snippet3":::