Core - Automatically merge enable-features/disable-features command-line arguments with existing values#5245
Conversation
…-line arguments with existing values
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds a boolean setting to control merging of ChangesFeature Command-Line Argument Merge Control
Sequence Diagram(s)sequenceDiagram
participant Client
participant CefSharpApp
participant CefSharpSettings
participant CommandLine
participant CommandLineArgsMerger
Client->>CefSharpApp: supply enable-features / disable-features arg
CefSharpApp->>CefSharpSettings: read MergeFeaturesCommandLineArgs
alt Merge enabled
CefSharpApp->>CommandLine: read existing switch value
CommandLine-->>CefSharpApp: existingValue
CefSharpApp->>CommandLineArgsMerger: MergeFeatures(existingValue, incomingValue)
CommandLineArgsMerger-->>CefSharpApp: mergedValue
CefSharpApp->>CommandLine: set updated switch = mergedValue
else Merge disabled
CefSharpApp->>CommandLine: remove existing switch
CefSharpApp->>CommandLine: set switch = incomingValue
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@CefSharp.Core.Runtime/Internals/CefSharpApp.h`:
- Around line 212-228: The substring check using currentValue->Contains causes
incorrect duplicate detection; in the block gated by
CefSharpSettings::MergeFeaturesCommandLineArgs (around
commandLine->GetSwitchValue/name handling), replace the Contains-based logic
with proper comma-separated token parsing: split the existingValue (via
StringUtils::ToClr(existingValue)) and the incoming kvp->Value by commas, trim
whitespace, build a case-sensitive set/list of existing tokens, iterate the
incoming tokens and add only those not already present, then reconstruct the
merged comma-separated string and call commandLine->RemoveSwitch(name);
commandLine->AppendSwitchWithValue(name, StringUtils::ToNative(mergedValue));
this ensures exact-feature matching and correctly handles multi-feature inputs
like "Feature1,Feature2".
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: cdc755c2-d284-4ddc-b997-e038c8368ec6
📒 Files selected for processing (2)
CefSharp.Core.Runtime/Internals/CefSharpApp.hCefSharp/CefSharpSettings.cs
|
✅ Build CefSharp 147.0.100-CI5477 completed (commit c7cf2e36e2 by @SLT-World) |
|
✅ Build CefSharp 147.0.100-CI5478 completed (commit 754ee7190c by @SLT-World) |
|
✅ Build CefSharp 147.0.100-CI5479 completed (commit a61bfb6978 by @SLT-World) |
|
Thanks for the PR. We should be able to create a c# method that handles the actual merging logic, then we can write some unit tests. Not sure why it would be called twice, will need to run with debugger attached to see if there's anything obvious, might be an unexpected CEF/Chromium behaviour. |
|
Sorry, I missed out on a duplicated I've relocated the merging logic to a C# method Would these changes be what you meant? |
|
✅ Build CefSharp 147.0.100-CI5481 completed (commit 8513884936 by @SLT-World) |
No prob 👍
Probably in https://github.com/cefsharp/CefSharp/tree/master/CefSharp.Test/Framework folder/namespace
Exactly 😄 |
Alright, I've added CommandLineArgsMergerTests in Would this suffice? |
|
✅ Build CefSharp 147.0.100-CI5483 completed (commit 0ac4c4428d by @SLT-World) |
|
Done, switched to using a |
|
✅ Build CefSharp 147.0.100-CI5484 completed (commit 13773558ad by @SLT-World) |
Excellent, thank you!
I'd be surprised if it mattered, guess alphabetical couldn't hurt. |
Core - Automatically merge
enable-features/disable-featurescommand-line arguments with existing values.Fixes: #5244
Summary:
enable-features/disable-featurescommand-line arguments with existing values.Containscheck was added to mitigate that issue.Changes: [specify the structures changed]
CefSharpApp.handCefSharpSettings.cs.MergeFeaturesCommandLineArgsto CefSharpSettings, defaults to true.enable-featuresanddisable-featureslists inCefSharpApp.h.How Has This Been Tested?
Operating System: Windows 11
Environment: Visual Studio 2022
Changes visibly function after appending and modifying
within
App.xaml.csinCefSharp.Wpf.HwndHost.Example.Screenshots (if appropriate):

Types of changes
Checklist:
Summary by CodeRabbit