Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add const keyword to resolve warnings (treated as errors) C26462 and C26496 #8567

Merged
merged 5 commits into from
Jun 21, 2023

Conversation

DmitriyKomin
Copy link
Contributor

In recent weeks, WinUI2 builds (local and lab) are failing due to the static analysis warnings (treated as errors) C26462 and C26496. These warnings enforce the C++ Core Guidelines rule "Con.4: Use const to define objects with values that do not change after construction."

C26462 and C26496 have been part of build/PrefastWarnings.ruleset since July 2020 and their handling in the build does not appear to have changed, so it's not clear why new occurrences are being picked up now. My best guess is that recent fixes/improvements to VS toolset have enabled new classes of this condition to be identified, and as the update rolls out, we are seeing increasing build failures of this sort.

Address the 100 newly identified "should use const" warnings (-> errors) by adding const keyword to variable/pointer variable declarations.

@DmitriyKomin
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@microsoft-github-policy-service microsoft-github-policy-service bot added the needs-triage Issue needs to be triaged by the area owners label Jun 20, 2023
@DmitriyKomin
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ranjeshj
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ranjeshj
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ranjeshj
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@bpulliam bpulliam removed the needs-triage Issue needs to be triaged by the area owners label Jun 21, 2023
@karkarl karkarl merged commit f6b2101 into main Jun 21, 2023
32 checks passed
@karkarl karkarl deleted the user/dkomin/const_warnings_fix branch June 21, 2023 17:09
kmahone pushed a commit that referenced this pull request Jul 7, 2023
…C26496 (#8567)

* Add const keyword as needed to resolve warnings C26462,C26496

* fix typo

* few more fixes

* add deprecated link

* fix pointer in const

---------

Co-authored-by: Dmitriy Komin <[email protected]>
Co-authored-by: Ranjesh Jaganathan <[email protected]>
Co-authored-by: Karen Lai <[email protected]>
kmahone added a commit that referenced this pull request Jul 7, 2023
Includes these fixes:
* [Fix Deprecated icons ](#8576)
* [Fix Voice Access 'Show Bubbles' annotation of WebView2 Content](#8551)
* [Add const keyword to resolve warnings (treated as errors) C26462 and C26496](#8567)
* [[WebView2] Apply text scale factor to CoreWebView2 content](#8540)
* [Fix horizontal scrolling on trackpad](#8403)
ronanlee777 added a commit to ronanlee777/csharp-microsoft that referenced this pull request Aug 5, 2024
Includes these fixes:
* [Fix Deprecated icons ](microsoft/microsoft-ui-xaml#8576)
* [Fix Voice Access 'Show Bubbles' annotation of WebView2 Content](microsoft/microsoft-ui-xaml#8551)
* [Add const keyword to resolve warnings (treated as errors) C26462 and C26496](microsoft/microsoft-ui-xaml#8567)
* [[WebView2] Apply text scale factor to CoreWebView2 content](microsoft/microsoft-ui-xaml#8540)
* [Fix horizontal scrolling on trackpad](microsoft/microsoft-ui-xaml#8403)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants