Core - ARM64 support for .Net 4.8.1 (rebased) - #5267
Conversation
|
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:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (14)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughARM64 build targets are added across the solution, native and managed projects, runtime loading code, and NuGet packaging. ChangesARM64 build and packaging support
Estimated code review effort: 4 (Complex) | ~60 minutes Merge Risk: ⚪ Minimal · up to This change adds ARM64 build, runtime-loading, and package asset support for .NET Framework 4.8.1 on Windows ARM64. No concrete current-head merge-blocking risk remains. Sequence Diagram(s)sequenceDiagram
participant Application
participant CefRuntime
participant RuntimeInformation
participant CefSharpCoreRuntime
Application->>CefRuntime: Request AnyCPU runtime loading
CefRuntime->>RuntimeInformation: Read ProcessArchitecture
CefRuntime->>CefSharpCoreRuntime: Resolve and load architecture-specific runtime
CefSharpCoreRuntime-->>CefRuntime: Return assembly or file-not-found result
CefRuntime-->>Application: Complete loading or raise error
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Out of Scope Changes checkExplanation The ARM64 work is in scope, but the pull request also upgrades the CEF SDK and runtime packages from 150.0.11 to 151.3.16 and changes default build versions. These changes are not explicitly required by issue
✨ 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 |
| </ItemGroup> | ||
| <Target Name="PostBuild" AfterTargets="PostBuildEvent"> | ||
| <Exec Command="if $(PlatformName) == x86 (
 call "$(DevEnvDir)..\..\VC\Auxiliary\Build\vcvars32.bat"
 editbin /largeaddressaware /TSAWARE "$(TargetPath)" 
 sn -R "$(TargetPath)" "$(ProjectDir)..\CefSharp.snk"
) else (
 call "$(DevEnvDir)..\..\VC\Auxiliary\Build\vcvars64.bat"
 editbin /TSAWARE /STACK:8388608 "$(TargetPath)"
 sn -R "$(TargetPath)" "$(ProjectDir)..\CefSharp.snk"
)" /> | ||
| <Exec Command="if $(PlatformName) == x86 (
 call "$(DevEnvDir)..\..\VC\Auxiliary\Build\vcvars32.bat"
 editbin /largeaddressaware /TSAWARE "$(TargetPath)" 
 sn -R "$(TargetPath)" "$(ProjectDir)..\CefSharp.snk"
) else if $(PlatformName) == x64 (
 call "$(DevEnvDir)..\..\VC\Auxiliary\Build\vcvars64.bat"
 editbin /TSAWARE /STACK:8388608 "$(TargetPath)"
 sn -R "$(TargetPath)" "$(ProjectDir)..\CefSharp.snk"
) else if $(PlatformName) == arm64 (
 call "$(DevEnvDir)..\..\VC\Auxiliary\Build\vcvarsamd64_arm64.bat"
 editbin /TSAWARE /STACK:8388608 "$(TargetPath)"
 sn -R "$(TargetPath)" "$(ProjectDir)..\CefSharp.snk"
)" /> |
There was a problem hiding this comment.
Need to verify the output with dumpbin
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 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 `@build.ps1`:
- Around line 495-499: The default multi-arch path now includes arm64, but VSX
still bootstraps the VC environment from only the first entry in $ARCHES, so the
arm64 build can inherit the wrong toolset. Update the VC setup logic in VSX to
select an arm64-capable vcvarsall mode whenever the arches list contains arm64,
or otherwise ensure the initial bootstrap matches the architectures being built
instead of always using $ARCHES[0].
In `@CefSharp.BrowserSubprocess/CefSharp.BrowserSubprocess.csproj`:
- Line 45: The build step in CefSharp.BrowserSubprocess.csproj uses the
x64-to-ARM64 cross toolchain for the arm64 branch, which is incorrect for native
ARM64 Visual Studio environments. Update the Exec command in the browser
subprocess project so the arm64 path uses the native ARM64 vcvars bootstrap (or
branches on host architecture to choose the right vcvars entrypoint) before
running editbin and sn, keeping the existing x86 and x64 behavior unchanged.
In `@NuGet/CefSharp.Common.targets`:
- Around line 472-475: The AnyCPU restore-copy path in CefSharp.Common.targets
updates the x86/x64 destination properties but leaves the arm64 destination
unmodified, so the arm64 payload is copied to the root instead of an arm64
subfolder. Update the property group that defines CefRedistArm64TargetDir so the
AnyCPU case appends arm64\ in the same way CefRedist32TargetDir and
CefRedist64TargetDir append x86\ and x64\, and keep the change aligned with the
AnyCPU restore-copy target that now includes arm64.
🪄 Autofix (Beta)
✅ Autofix completed
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 6d80cf05-8ab1-46c2-9ce7-3da49111f671
📒 Files selected for processing (22)
CefSharp.BrowserSubprocess.Core/CefSharp.BrowserSubprocess.Core.vcxprojCefSharp.BrowserSubprocess/CefSharp.BrowserSubprocess.csprojCefSharp.Core.Runtime/CefSharp.Core.Runtime.vcxprojCefSharp.Native.propsCefSharp.OffScreen.Example/CefSharp.OffScreen.Example.csprojCefSharp.OffScreen.Example/CefSharp.OffScreen.Example.netcore.csprojCefSharp.Test/CefSharp.Test.csprojCefSharp.Test/CefSharp.Test.netcore.csprojCefSharp.WinForms.Example/CefSharp.WinForms.Example.csprojCefSharp.WinForms.Example/CefSharp.WinForms.Example.netcore.csprojCefSharp.Wpf.Example/CefSharp.Wpf.Example.csprojCefSharp.Wpf.Example/CefSharp.Wpf.Example.netcore.csprojCefSharp.Wpf.HwndHost.Example/CefSharp.Wpf.HwndHost.Example.csprojCefSharp.Wpf.HwndHost.Example/CefSharp.Wpf.HwndHost.Example.netcore.csprojCefSharp/CefRuntime.csCefSharp/CefSharp.csprojCefSharp/DependencyChecker.csCefSharp3.slnNuGet/CefSharp.Common.nuspecNuGet/CefSharp.Common.propsNuGet/CefSharp.Common.targetsbuild.ps1
| </ItemGroup> | ||
| <Target Name="PostBuild" AfterTargets="PostBuildEvent"> | ||
| <Exec Command="if $(PlatformName) == x86 (
 call "$(DevEnvDir)..\..\VC\Auxiliary\Build\vcvars32.bat"
 editbin /largeaddressaware /TSAWARE "$(TargetPath)" 
 sn -R "$(TargetPath)" "$(ProjectDir)..\CefSharp.snk"
) else (
 call "$(DevEnvDir)..\..\VC\Auxiliary\Build\vcvars64.bat"
 editbin /TSAWARE /STACK:8388608 "$(TargetPath)"
 sn -R "$(TargetPath)" "$(ProjectDir)..\CefSharp.snk"
)" /> | ||
| <Exec Command="if $(PlatformName) == x86 (
 call "$(DevEnvDir)..\..\VC\Auxiliary\Build\vcvars32.bat"
 editbin /largeaddressaware /TSAWARE "$(TargetPath)" 
 sn -R "$(TargetPath)" "$(ProjectDir)..\CefSharp.snk"
) else if $(PlatformName) == x64 (
 call "$(DevEnvDir)..\..\VC\Auxiliary\Build\vcvars64.bat"
 editbin /TSAWARE /STACK:8388608 "$(TargetPath)"
 sn -R "$(TargetPath)" "$(ProjectDir)..\CefSharp.snk"
) else if $(PlatformName) == arm64 (
 call "$(DevEnvDir)..\..\VC\Auxiliary\Build\vcvarsamd64_arm64.bat"
 editbin /TSAWARE /STACK:8388608 "$(TargetPath)"
 sn -R "$(TargetPath)" "$(ProjectDir)..\CefSharp.snk"
)" /> |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🌐 Web query:
For Visual Studio 2022 C++ command-line environments, what vcvars batch file should be used when the host machine is Windows ARM64 and the target architecture is ARM64?
💡 Result:
When the host machine is Windows ARM64 and you are targeting ARM64, the recommended approach is to use the vcvarsall.bat batch file with the arm64 argument [1]. To initialize the environment, execute the following command in your command-line shell: "C:\Program Files\Microsoft Visual Studio\2022[Edition]\VC\Auxiliary\Build\vcvarsall.bat" arm64 Replace [Edition] with your specific Visual Studio 2022 edition (e.g., Community, Professional, or Enterprise). Using the arm64 argument invokes the native ARM64-hosted toolchain, which is the correct environment for building ARM64 binaries on an ARM64 machine [2][1]. While some cross-compilation batch files exist for other scenarios (such as vcvarsamd64_arm64.bat for x64-to-ARM64 builds), they are not appropriate when the host is already ARM64, as using an emulated or cross-hosted environment can lead to issues, such as the inability to correctly utilize certain compiler switches like /arm64EC [3][2]. Alternatively, Visual Studio 2022 provides an "ARM64 Developer Command Prompt" shortcut in the Start menu that automatically runs this configuration for you [3].
Citations:
- 1: MSVC first-class support for producing ARM64EC binaries SCons/scons#4745
- 2: https://github.com/MicrosoftDocs/visualstudio-docs/blob/main/docs/install/visual-studio-on-arm-devices.md
- 3: https://neuroanswers.net/c/programming/q/build-arm64ec-visual-studio-2022-command-line
Use the native ARM64 vcvars bootstrap here. vcvarsamd64_arm64.bat is the x64→ARM64 cross-environment; on ARM64-hosted VS this should use vcvarsall.bat arm64 (or branch on host architecture) so editbin and sn run under the native ARM64 toolchain.
🤖 Prompt for 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.
In `@CefSharp.BrowserSubprocess/CefSharp.BrowserSubprocess.csproj` at line 45, The
build step in CefSharp.BrowserSubprocess.csproj uses the x64-to-ARM64 cross
toolchain for the arm64 branch, which is incorrect for native ARM64 Visual
Studio environments. Update the Exec command in the browser subprocess project
so the arm64 path uses the native ARM64 vcvars bootstrap (or branches on host
architecture to choose the right vcvars entrypoint) before running editbin and
sn, keeping the existing x86 and x64 behavior unchanged.
There was a problem hiding this comment.
CI is only going to cross compile so that's the priority, native compilation support can be added in a follow up PR.
show proposed change for future reference.
There was a problem hiding this comment.
@amaitland, makes sense — if CI is only doing x64-hosted cross-compilation for this PR, I’m happy to treat native ARM64-hosted VS support as follow-up work.
For future reference, here’s the shape of the change I had in mind for Line 45, keeping the existing x86/x64 behavior unchanged and only making the arm64 path host-aware:
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="if $(PlatformName) == x86 (&`#xD`;&`#xA`; call "$(DevEnvDir)..\..\VC\Auxiliary\Build\vcvars32.bat"&`#xD`;&`#xA`; editbin /largeaddressaware /TSAWARE "$(TargetPath)"&`#xD`;&`#xA`; sn -R "$(TargetPath)" "$(ProjectDir)..\CefSharp.snk"&`#xD`;&`#xA`;) else if $(PlatformName) == x64 (&`#xD`;&`#xA`; call "$(DevEnvDir)..\..\VC\Auxiliary\Build\vcvars64.bat"&`#xD`;&`#xA`; editbin /TSAWARE /STACK:8388608 "$(TargetPath)"&`#xD`;&`#xA`; sn -R "$(TargetPath)" "$(ProjectDir)..\CefSharp.snk"&`#xD`;&`#xA`;) else if $(PlatformName) == arm64 (&`#xD`;&`#xA`; if /I "%PROCESSOR_ARCHITECTURE%" == "ARM64" (&`#xD`;&`#xA`; call "$(DevEnvDir)..\..\VC\Auxiliary\Build\vcvarsall.bat" arm64&`#xD`;&`#xA`; ) else (&`#xD`;&`#xA`; call "$(DevEnvDir)..\..\VC\Auxiliary\Build\vcvarsamd64_arm64.bat"&`#xD`;&`#xA`; )&`#xD`;&`#xA`; editbin /TSAWARE /STACK:8388608 "$(TargetPath)"&`#xD`;&`#xA`; sn -R "$(TargetPath)" "$(ProjectDir)..\CefSharp.snk"&`#xD`;&`#xA`;)" />
</Target>That would preserve the current CI path while also handling native ARM64-hosted developer environments later.
If you want, I can also open a follow-up issue for that so it doesn’t get lost.
|
✅ Build CefSharp 149.0.40-CI5546 completed (commit b8a1244891 by @amaitland) |
|
Note Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it. Fixes Applied SuccessfullyFixed 1 file(s) based on 1 unresolved review comment. A stacked PR containing fixes has been created.
Time taken: |
|
✅ Build CefSharp 149.0.40-CI5548 completed (commit c98eee8cb3 by @amaitland) |
6bf720e to
4c02c35
Compare
|
✅ Build CefSharp 150.0.110-CI5556 completed (commit a66d263e82 by @amaitland) |
4c02c35 to
43b9ff5
Compare
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/CefRuntime.cs`:
- Around line 22-25: Update the <param name="basePath"> documentation in both
affected method summaries in CefRuntime to list x64, x86, and arm64 folders,
matching the architecture behavior already described elsewhere. Change
documentation only and preserve the existing parameter wording.
🪄 Autofix
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 4fc7996e-97e9-4976-b5fb-635dd05cde6d
📒 Files selected for processing (22)
CefSharp.BrowserSubprocess.Core/CefSharp.BrowserSubprocess.Core.vcxprojCefSharp.BrowserSubprocess/CefSharp.BrowserSubprocess.csprojCefSharp.Core.Runtime/CefSharp.Core.Runtime.vcxprojCefSharp.Native.propsCefSharp.OffScreen.Example/CefSharp.OffScreen.Example.csprojCefSharp.OffScreen.Example/CefSharp.OffScreen.Example.netcore.csprojCefSharp.Test/CefSharp.Test.csprojCefSharp.Test/CefSharp.Test.netcore.csprojCefSharp.WinForms.Example/CefSharp.WinForms.Example.csprojCefSharp.WinForms.Example/CefSharp.WinForms.Example.netcore.csprojCefSharp.Wpf.Example/CefSharp.Wpf.Example.csprojCefSharp.Wpf.Example/CefSharp.Wpf.Example.netcore.csprojCefSharp.Wpf.HwndHost.Example/CefSharp.Wpf.HwndHost.Example.csprojCefSharp.Wpf.HwndHost.Example/CefSharp.Wpf.HwndHost.Example.netcore.csprojCefSharp/CefRuntime.csCefSharp/CefSharp.csprojCefSharp/DependencyChecker.csCefSharp3.slnNuGet/CefSharp.Common.nuspecNuGet/CefSharp.Common.propsNuGet/CefSharp.Common.targetsbuild.ps1
🚧 Files skipped from review as they are similar to previous changes (19)
- NuGet/CefSharp.Common.props
- CefSharp.WinForms.Example/CefSharp.WinForms.Example.netcore.csproj
- CefSharp/DependencyChecker.cs
- CefSharp.Wpf.Example/CefSharp.Wpf.Example.netcore.csproj
- CefSharp.OffScreen.Example/CefSharp.OffScreen.Example.netcore.csproj
- CefSharp.BrowserSubprocess/CefSharp.BrowserSubprocess.csproj
- CefSharp.Test/CefSharp.Test.netcore.csproj
- CefSharp.Wpf.HwndHost.Example/CefSharp.Wpf.HwndHost.Example.netcore.csproj
- CefSharp.Wpf.HwndHost.Example/CefSharp.Wpf.HwndHost.Example.csproj
- CefSharp.WinForms.Example/CefSharp.WinForms.Example.csproj
- NuGet/CefSharp.Common.nuspec
- CefSharp.Native.props
- CefSharp/CefSharp.csproj
- CefSharp3.sln
- CefSharp.BrowserSubprocess.Core/CefSharp.BrowserSubprocess.Core.vcxproj
- CefSharp.OffScreen.Example/CefSharp.OffScreen.Example.csproj
- CefSharp.Core.Runtime/CefSharp.Core.Runtime.vcxproj
- NuGet/CefSharp.Common.targets
- CefSharp.Test/CefSharp.Test.csproj
| /// needs to be loaded (x64/x86/arm64). | ||
| /// This method subscribes to the <see cref="AppDomain.AssemblyResolve"/> event | ||
| /// for <see cref="AppDomain.CurrentDomain"/> and loads the CefSharp.Core.Runtime.dll | ||
| /// based on <see cref="Environment.Is64BitProcess"/>. | ||
| /// based on the current process architecture. |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Update the remaining path documentation for arm64.
The expanded method summaries still leave the <param name="basePath"> descriptions at Lines 31-32 and 87-88 describing only x64/x86 folders. Include arm64 there as well so the public API documentation matches the new behavior.
📝 Proposed documentation fix
- /// The path containing the x64/x86 folders which contain the CefSharp/CEF resources.
+ /// The path containing the x64/x86/arm64 folders which contain the CefSharp/CEF resources.Also applies to: 79-81
🤖 Prompt for 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.
In `@CefSharp/CefRuntime.cs` around lines 22 - 25, Update the <param
name="basePath"> documentation in both affected method summaries in CefRuntime
to list x64, x86, and arm64 folders, matching the architecture behavior already
described elsewhere. Change documentation only and preserve the existing
parameter wording.
|
✅ Build CefSharp 150.0.110-CI5571 completed (commit 653998f37b by @amaitland) |
Co-authored-by: M4ttsson <4147055+M4ttsson@users.noreply.github.com>
165b1ca to
d920591
Compare
|
🤖 Completed: Fix CodeRabbit issues in PR #5267 — View commit |
|
✅ Build CefSharp 151.3.160-CI5614 completed (commit 7d1647f851 by @coderabbitai[bot]) |
|
Tip For best results, initiate chat on the files or code changes.
You are interacting with an AI system. |
Fixes #4155
Summary by CodeRabbit