-
Notifications
You must be signed in to change notification settings - Fork 7.2k
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
Clarify defaultRefAssemblies list capacity in AddType.cs #12520
Conversation
Expand `defaultRefAssemblies` initial list capacity to be greater than number of items stored.
src/Microsoft.PowerShell.Commands.Utility/commands/utility/AddType.cs
Outdated
Show resolved
Hide resolved
8db24b3
to
3528365
Compare
src/Microsoft.PowerShell.Commands.Utility/commands/utility/AddType.cs
Outdated
Show resolved
Hide resolved
address @ iSazonov review
src/Microsoft.PowerShell.Commands.Utility/commands/utility/AddType.cs
Outdated
Show resolved
Hide resolved
address @iSazonov review
Question - is there a way to verify that assertion in a way that can be tested in CI? Debug asserts are great but can cause annoying crashes which seems to be more likely to be a nuisance in a case like this. Can we add a unit test in C# to verify this instead, so we get a clear test failure without generating broken build artifacts? Doubly so if we're expecting this number to change in future, we should be very careful about using a debug assert here, which will render this functionality entirely unusable in debug builds and I'm not sure will even show up in CI at all. |
I guess the value depends only on .Net version and we will catch the exception only after moving to new version and only for local debug builds. Also we can count refs at design time - see code after |
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
Hello @iSazonov! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
# PR Summary * Increase the list capacity because .NET v5.0.100-preview.5.20278.13 has an extra assembly * Remove assert added in #12520 ## PR Context HEAD of master has been broken since 99da109 (#12772), when .NET was updated to 5.0.100-preview.5.20278.13 #12815 (comment) ## PR Checklist - [x] [PR has a meaningful title](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#pull-request---submission) - Use the present tense and imperative mood when describing your changes - [x] [Summarized changes](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#pull-request---submission) - [x] [Make sure all `.h`, `.cpp`, `.cs`, `.ps1` and `.psm1` files have the correct copyright header](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#pull-request---submission) - [x] This PR is ready to merge and is not [Work in Progress](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#pull-request---work-in-progress). - If the PR is work in progress, please add the prefix `WIP:` or `[ WIP ]` to the beginning of the title (the `WIP` bot will keep its status check at `Pending` while the prefix is present) and remove the prefix when the PR is ready. - **[Breaking changes](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#making-breaking-changes)** - [x] None - **OR** - [ ] [Experimental feature(s) needed](https://github.com/MicrosoftDocs/PowerShell-Docs/blob/staging/reference/6/Microsoft.PowerShell.Core/About/about_Experimental_Features.md) - [ ] Experimental feature name(s): <!-- Experimental feature name(s) here --> - **User-facing changes** - [x] Not Applicable - **OR** - [ ] [Documentation needed](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#pull-request---submission) - [ ] Issue filed: <!-- Number/link of that issue here --> - **Testing - New and feature** - [x] N/A or can only be tested interactively - **OR** - [ ] [Make sure you've added a new test if existing tests do not effectively test the code changed](https://github.com/PowerShell/PowerShell/blob/master/.github/CONTRIBUTING.md#before-submitting) - **Tooling** - [x] I have considered the user experience from a tooling perspective and don't believe tooling will be impacted. - **OR** - [ ] I have considered the user experience from a tooling perspective and enumerated concerns in the summary. This may include: - Impact on [PowerShell Editor Services](https://github.com/PowerShell/PowerShellEditorServices) which is used in the [PowerShell extension](https://github.com/PowerShell/vscode-powershell) for VSCode (which runs in a different PS Host). - Impact on Completions (both in the console and in editors) - one of PowerShell's most powerful features. - Impact on [PSScriptAnalyzer](https://github.com/PowerShell/PSScriptAnalyzer) (which provides linting & formatting in the editor extensions). - Impact on [EditorSyntax](https://github.com/PowerShell/EditorSyntax) (which provides syntax highlighting with in VSCode, GitHub, and many other editors).
🎉 Handy links: |
PR Summary
defaultRefAssemblies
initial list capacity.PR Context
InitDefaultRefAssemblies may initialize a list too small to hold the reference assemblies distributed with netcoreapp5.0, which may result in an expensive reallocation of the internal array.
PR Checklist
.h
,.cpp
,.cs
,.ps1
and.psm1
files have the correct copyright headerWIP:
or[ WIP ]
to the beginning of the title (theWIP
bot will keep its status check atPending
while the prefix is present) and remove the prefix when the PR is ready.