Refactor build.cmd for ARM64 and add build.cmd.ps1#14702
Refactor build.cmd for ARM64 and add build.cmd.ps1#14702KlausLoeffelmann wants to merge 50 commits into
Conversation
|
@Olina-Zhang, @LeafShi1, @Shyam-Gupta:
This introduces a different batch file, which is picked up when you build locally on ARM (tested on a Surface X, work fine). If there is a better way to do this, please advise and then feel free to close the PR. Thanks! |
There was a problem hiding this comment.
Pull request overview
Refactors the repository’s root build.cmd entrypoint to delegate to a new eng/build.cmd.ps1 wrapper, aiming to improve argument handling and add guidance for building on Windows ARM64.
Changes:
- Added
eng/build.cmd.ps1to preprocess arguments (notably ARM64) before invokingeng/common/build.ps1. - Updated
build.cmdto call the new PowerShell wrapper instead of callingeng/common/build.ps1directly. - Updated
docs/building.mdwith Windows ARM64 build instructions.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| eng/build.cmd.ps1 | New wrapper script for build argument parsing and ARM64 detection before invoking eng/common/build.ps1. |
| build.cmd | Delegates to eng/build.cmd.ps1. |
| docs/building.md | Documents ARM64 build invocation via -platform arm64. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
I did a quick comparison between the current code and this PR. On my x64 machine, build -configuration release -platform ARM64 already succeeds and Platform=ARM64 appears in the generated binlog. With this change, I additionally see TargetArchitecture=arm64 being propagated. Was the issue primarily reproducible on native ARM64 devices (e.g. Surface X), or was the main problem that TargetArchitecture was not being set correctly for ARM builds? |
|
@KlausLoeffelmann we have a known issue: #12207 when using I tested |
|
@Olina-Zhang, @LeafShi1: |
563bb2c to
43a34c3
Compare
|
@KlausLoeffelmann tested on ARM64 VM for your new update, still failed with the same error I shared above. |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Hand-author the IUISettings3 / UIColor / UIColorType WinRT ABI types and generate the RoActivateInstance / WindowsCreateString / WindowsDeleteString / IInspectable / HSTRING Win32 bindings via CsWin32. The WinRT ABI types are excluded from the .NET Framework build, which does not consume them. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Expose the user's current Windows accent color by activating the Windows.UI.ViewManagement.UISettings runtime component and reading UIColorType.Accent. When no accent color is set, Windows returns an OS-defined default, so the method always yields a usable color. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Implements suspend painting and relocation scopes, deferred child positioning, and form appearance mode infrastructure for .NET 11. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…rface Splits DeferLocationChange out of this branch entirely (postponed pending an anchor-layout-engine integration fix; tracked separately in #12) and reworks ISupportSuspendPainting / ISupportSuspendRelocation on Control to match the final API shape agreed in dotnet#14585: - Control implements ISupportSuspendPainting/ISupportSuspendRelocation via explicit interface implementation instead of public virtual methods, so the manual Begin/End pair does not become the primary IntelliSense surface on every Control-derived type. Protected virtual BeginSuspendPaintingCore() / EndSuspendPaintingCore() / BeginSuspendRelocationCore() / EndSuspendRelocationCore() are the new override points. - ListView, ListBox, ComboBox, TreeView, RichTextBox override the ...Core() hooks instead of the old public virtual methods, still routing through their existing BeginUpdate/EndUpdate. - SuspendPaintingScope and SuspendRelocationScope change from readonly ref struct to sealed class : IDisposable, so the scope can span an await in an asynchronous UI event handler (a ref struct cannot be hoisted into an async state machine - this was the flagship usage scenario in the original API proposal, and it did not compile against the ref struct version). Dispose is idempotent. - Deletes DeferLocationChangeScope.cs and the Control.DeferLocationChange overloads entirely. - Updates/removes tests accordingly; updates PublicAPI.Unshipped.txt. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…inel Matches the final API shape agreed in dotnet#14585: - FormAppearanceMode -> FormRevealMode, adding Inherit = -1 as the ambient sentinel (Classic stays the CLR default value 0, matching the RightToLeft.Inherit / VisualStylesMode.Inherit precedent for ambient enums - the sentinel is a distinct value, not the zero value, so default(FormRevealMode) stays conservative). - Form.FormRevealMode is now a real public virtual, PropertyStore-backed, [AmbientValue(Inherit)] property (previously there was no per-Form property at all - only the flat, process-wide Application.FormAppearanceMode existed). This lets a form such as a splash screen opt itself out of deferred reveal without touching the process-wide default. Resolution is flat (Form only, no Control-parent-chain): DWM cloaking only ever applies to top-level, non-MDI-child windows, so there is no hierarchy to walk, unlike VisualStylesMode's genuine control-nesting cascade. - Application.FormAppearanceMode / SetFormAppearanceMode are replaced by three members: DefaultFormRevealMode (get; may return the unresolved Inherit sentinel, mirroring ColorMode returning the unresolved System value), SetDefaultFormRevealMode (freely reassignable, unlike the write-once SetDefaultVisualStylesMode - the effective default is derived in part from ColorMode/IsDarkModeEnabled, which are themselves mutable for the life of the process), and IsFormRevealDeferred (bool; the fully resolved answer: Deferred, or Inherit + IsDarkModeEnabled). This also fixes a compatibility problem in the original design: the old default was unconditionally Deferred whenever SetFormAppearanceMode was never called, an opt-out behavior change for every existing app; tying the Inherit resolution to dark mode means an app that never touches SystemColorMode sees no behavior change, while the scenario the feature exists for (dark-mode startup flash) is fixed by default. - ShouldUseDeferredAppearanceCloak now reads the resolved Form.FormRevealMode instead of the old flat Application-only check, so a per-Form override is actually honored. - Adds SR.resx/xlf entries for the new property's designer description. - Updates/adds tests; updates PublicAPI.Unshipped.txt. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adds Microsoft.VisualBasic.ApplicationServices.ApplyApplicationDefaultsEventArgs.FormRevealMode, following the exact same pattern already established for ColorMode and HighDpiMode in that class, per dotnet#14585's API Proposal. WindowsFormsApplicationBase now carries a _formRevealMode shadow field (defaulting to FormRevealMode.Classic, matching the existing conservative default for _colorMode) and a protected FormRevealMode property, feeds it into the ApplyApplicationDefaultsEventArgs constructor alongside MinimumSplashScreenDisplayTime/HighDpiMode/ColorMode, reads back whatever the ApplyApplicationDefaults event handler set, and calls Application.SetDefaultFormRevealMode(_formRevealMode) at the end of OnInitialize alongside the existing Application.SetColorMode(_colorMode) call. This completes work anticipated but never finished in an earlier .NET 9 Visual Styles attempt at this same VB Application Framework extension point (OnInitialize already carried a comment claiming "We feed the defaults for HighDpiMode, ColorMode, VisualStylesMode to the EventArgs", but only HighDpiMode/ColorMode were ever actually wired up). Updates PublicAPI.Unshipped.txt for Microsoft.VisualBasic.Forms. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ng, and test cancellation/nullable guidance - building-code: add a top-level TENET to build the solution only with build.cmd (CI parity for PublicAPI/analyzer enforcement and -warnAsError); a plain dotnet build is inner-loop only. - new-control-api: new public/protected overrides must be tracked in PublicAPI.Unshipped.txt with the override prefix; note CS0114 (new keyword) and CS1574 (no cref to cross-assembly internal types). - control-api-tests: async tests must pass CancellationToken (TestContext.Current.CancellationToken, CA2016/xUnit1051) and respect the #nullable context (CS8632). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ng, and test cancellation/nullable guidance - building-code: add a top-level TENET to build the solution only with build.cmd (CI parity for PublicAPI/analyzer enforcement and -warnAsError); a plain dotnet build is inner-loop only. - new-control-api: new public/protected overrides must be tracked in PublicAPI.Unshipped.txt with the override prefix; note CS0114 (new keyword) and CS1574 (no cref to cross-assembly internal types). - control-api-tests: async tests must pass CancellationToken (TestContext.Current.CancellationToken, CA2016/xUnit1051) and respect the #nullable context (CS8632). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…n Button and CheckBox toggle renderers Introduces the (non-experimental) Visual Styles versioning API and the first modern renderers gated behind it: - VisualStylesMode enum (Classic/Disabled/Net11/Latest); ambient Control.VisualStylesMode (+event/On-methods); Application.DefaultVisualStylesMode/SetDefaultVisualStylesMode; Appearance.ToggleSwitch; VB framework APIs. - HighPrecisionTimer (internal, Primitives) as the animation frame trigger, with tests. - AnimationManager/AnimatedControlRenderer driven by HighPrecisionTimer. - Conservative dark-mode Standard button (owner-drawn, reachable) + modern WinUI-style Button renderer. - CheckBox Appearance.ToggleSwitch modern toggle switch (animated, flicker-free). - WinformsControlsTest VisualStylesButtons exploratory harness; unit tests. Verified CI-clean with build.cmd: System.Windows.Forms, Microsoft.VisualBasic.Forms and Primitives build with no analyzer/PublicAPI/style errors (the only remaining failure is the pre-existing BuildAssist/AxHosts step, which is an environment limitation unrelated to these changes). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Add solution folders "Application" and "net11-VisualStylesMode" to Winforms.sln and include a detailed Markdown work order for porting non-client painting and VisualStylesMode chrome to VisualStylesNet11. * Update solution structure to organize these items for engineering reference.
…lesNet11 Bring the non-client (NC) painting feature for TextBoxBase/TextBox from the pinned SHA cf32e9c onto the modern VisualStylesNet11 layout, with the DECIDED design changes and the Prompt-2 MUST-FIX items applied. TextBoxBase.cs: * Add VisualStyles border-padding consts + BorderThickness and the _triggerNewClientSizeRequest latch (reset in CreateHandle). * Split PreferredHeight into a VisualStylesMode switch over PreferredHeightCore (modern) and PreferredHeightClassic (Everett-compatible). Dropped the original [Experimental]/WFO5000 gating - VisualStyles is not experimental on this branch. * Add GetVisualStylesPadding / virtual GetScrollBarPadding (DPI-scaled). * Add the VisualStylesMode >= Net11 branch to GetPreferredSizeCore. * Add WmNcPaint / OnNcPaint / InitializeClientArea / WmNcCalcSize and the WM_NCCALCSIZE / WM_NCPAINT WndProc cases; wire InitializeClientArea into InitializeDCForWmCtlColor. * Add NC-frame invalidation to OnGotFocus / OnLostFocus / OnSizeChanged (OnLostFocus now correctly guarded by VisualStylesMode, fixing the original asymmetry). DECIDED design (work-order steps 6-8): * Use the shared BufferedGraphics buffer (BufferedGraphicsManager.Current) instead of the per-instance NonClientBitmapCache; buffer.Render() blits to the window DC. * Use the shipped Graphics.FillRoundedRectangle / DrawRoundedRectangle methods. * Never-invert clamp in WmNcCalcSize (no MinimumSize); paint-time chrome degradation in OnNcPaint below the viable rounded-chrome height. * Fixed the WmNcPaint double-dispose. MUST-FIX: * DPI-scale the corner radius and border thickness (and the degradation threshold) via LogicalToDeviceUnits. TextBox.cs: * Guard the classic PRF_NONCLIENT Fixed3D border draw so it does not double-draw over the modern chrome when VisualStylesMode >= Net11. NativeMethods.txt: * Generate GetWindowDC and NCCALCSIZE_PARAMS. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Previously InvokeCallbackAsync used 'catch (Exception ex) when (ex is not OperationCanceledException)', which let an OperationCanceledException escape the handler entirely. Because the callback runs as a discarded fire-and-forget task (SyncContext.Post of '_ = InvokeCallbackAsync(...)'), the escaping OCE faulted that task into an unobserved task exception that only surfaced via TaskScheduler.UnobservedTaskException on GC. Catch the OCE explicitly and ignore it when our cancellation token is signalled (mirroring the TimerLoopAsync convention), so cancellation during timer shutdown is a clean no-op. Genuine, non-cancellation exceptions still route to Debug.Fail. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
VisualStylesMode and DataContext are ambient via property-store absence, which is sufficient at runtime and for the normal serialization path. But a 'truly ambient' property the designer can reset also needs a writable 'inherit' token: the CodeDOM serializer (PropertyMemberCodeDomSerializer) substitutes an [AmbientValue] when it is forced to emit an otherwise-ambient property (inherited/'difference' forms, member relationships, absolute serialization). Without it the resolved concrete value is baked in, breaking re-inheritance in those designer scenarios. VisualStylesMode had no inherit sentinel, so [AmbientValue] had no correct value to use. Add one, mirroring RightToLeft.Inherit: * Add VisualStylesMode.Inherit (= -1). It is an assignable sentinel; the resolved value is never Inherit (the getter resolves a stored/assigned Inherit to the parent or Application.DefaultVisualStylesMode), so the '>= Net11' gating elsewhere is unaffected. * Annotate Control.VisualStylesMode with [AmbientValue(VisualStylesMode.Inherit)] and make the setter treat Inherit (and 'equals parent') as 'clear the local override' so it re-inherits; raise the change event only when the resolved value changes. * Reject VisualStylesMode.Inherit in Application.SetDefaultVisualStylesMode (the app root has no parent to inherit from); also validate undefined values there. * DataContext deliberately keeps NO [AmbientValue]: its setter stores an explicit null rather than clearing the override, so null would be a leaky 'inherit' sentinel. Added a maintainer comment explaining why. Update PublicAPI.Unshipped.txt, SR + xlf, and the VisualStylesMode unit tests (the old '-1 is invalid' case is now Inherit; add re-inherit, never-returns-Inherit, and SetDefaultVisualStylesMode(Inherit) throws coverage). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…or TextBoxBase WM_NCPAINT now passes base.WndProc a client-excluding update region (screen coordinates) so the default themed non-client paint no longer erases the edit client area (e.g. on hover) for scrollbar-bearing TextBox/RichTextBox. Also: fix Release-only CS8175 by capturing the cached Pen (not the ref-struct scope) in the OnNcPaint focus-line local functions; extract the RichEdit-specific ScrollToCaret logic into a RichTextBox override of a new private protected virtual ScrollToCaretCore; and documentation/comment cleanups (GetVisualStylesPadding, GetPreferredSizeCore, WindowText, PaddingChanged) plus Everett capitalization. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Shrink the gap between the rounded button body and the outer focus ring and grow the body to reclaim that space. When the focus ring is not drawn, the body now expands to fill the ring+gap band via a focus-aware GetContentPadding hook, so unfocused buttons feel less cramped without changing the control's Padding. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Port the prototype material key-cap renderer into System.Windows.Forms.Rendering.Button (renamed to Popup/FlatStyle conventions, no MaterialKey naming). Button owner-paints FlatStyle.Popup under modern visual styles or dark mode via a timer-driven AnimatedPopupButtonRenderer that interpolates hover/press channels through the shared AnimationManager, mirroring the CheckBox toggle switch. Border width/color are read from FlatButtonAppearance. The old PopupButtonDarkModeRenderer is removed; the dark-mode adapter keeps the modern renderer for Popup layout only. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…Button Route the Appearance.Button rendering of CheckBox and RadioButton through DarkModeAdapterFactory so it reuses the modern ButtonDarkModeAdapter/renderers under dark mode or modern visual styles, matching modern push buttons (including checked-as-pressed state). Classic mode is unchanged. The concrete-type ButtonAdapter casts are dropped so the delegated adapter can be the shared ButtonDarkModeAdapter. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The Appearance.ToggleSwitch renderer placed the switch based on TextAlign, so the default (MiddleLeft) drew the switch on the right. Drive placement from CheckAlign instead: left/center-aligned values (including the MiddleLeft default) put the switch on the left with the caption on the right, and right-aligned values put it on the right. Vertical centering is unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Refactored build.cmd to delegate to a new PowerShell script (build.cmd.ps1) for improved argument parsing and platform detection. * Added support for building on Windows ARM64 via the -platform arm64 option, which sets TargetArchitecture and disables NativeToolsOnMachine. * Updated documentation to reflect the new ARM64 build instructions.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Introduce EffectiveVisualStylesMode to clamp visual styles to Classic when Windows High Contrast is active, ensuring consistent rendering and accessibility. Update all controls to use this property for rendering and CreateParams decisions. * Override Form.OnSystemColorsChanged to handle High Contrast transitions by recreating handles as needed. Remove VisualStylesMode.LatestPreview and update related logic. * Expose EffectiveVisualStylesMode to owner-drawn button adapters for correct renderer selection.
Rewrite the write-once application default test to no longer reference the removed VisualStylesMode.LatestPreview member. The test now uses Net11 as the established (write-twice-with-same-value) mode and Latest as the differing value that must throw. Also drop stale LatestPreview mentions from the validation comments in Application.SetDefaultVisualStylesMode and Control.VisualStylesMode. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 41e90924-3241-42a8-9556-71e100be7e59
Align VisualStylesMode with the other ambient properties (BackColor, Cursor, Font, ForeColor, RightToLeft), which are all public virtual. Making it virtual allows derived controls to transform the ambient value that children observe through ParentInternal.VisualStylesMode. The property is still unshipped, so this only updates the PublicAPI.Unshipped.txt entries. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 41e90924-3241-42a8-9556-71e100be7e59
Override the now-virtual Control.VisualStylesMode in PropertyGrid to always return VisualStylesMode.Classic. The editing controls hosted inside the grid read the ambient VisualStylesMode from their parent chain; because the property is virtual, they resolve to Classic and never switch to a modern renderer whose frame/glyph metrics would not line up with the grid's fixed layout. The setter stores the requested value in a backing field for potential future use but currently has no effect, so setting Net11/Latest is a genuine no-op. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 41e90924-3241-42a8-9556-71e100be7e59
RichEdit (MSFTEDIT) does not send the WM_CTLCOLOR messages a plain EDIT control uses to lazily trigger the modern Visual Styles client-area carve, so the carve never ran and Padding had no effect. RichEdit also reserves its own border and scrollbar space during WM_NCCALCSIZE, so the managed carve must be applied on top of the native result rather than the raw proposed window rectangle. - TextBoxBase: extract the carve trigger into RecalculateVisualStylesClientArea so it can be re-provoked, add the ReservesNativeNonClientArea hook so WmNcCalcSize runs the default handler first for such controls, and re-provoke the carve from OnPaddingChanged so runtime Padding changes apply. - RichTextBox: opt into ReservesNativeNonClientArea, return an empty GetScrollBarPadding (RichEdit already reserves the scrollbars), and trigger the carve explicitly in OnHandleCreated since WM_CTLCOLOR never arrives. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 41e90924-3241-42a8-9556-71e100be7e59
When a modern VisualStylesMode (Net11 or above) is in effect, lay out the UpDownBase increment/decrement buttons side by side instead of stacked, so each button gets a larger, more accessible click target. The decrement (down) button sits on the leading edge and the increment (up) button on the trailing edge, mirrored under right-to-left. - UpDownBase: add internal UseSideBySideButtons (gated on EffectiveVisualStylesMode >= Net11); widen the button band to 2x in PositionControls when active. - UpDownButtons: centralize hit-testing in GetButtonRectangle(ButtonID) (stacked = top/bottom half, side-by-side = leading/trailing half, RTL aware); route BeginButtonPress, OnMouseMove and accessibility bounds through it. Render the modern layout with DrawModernControlButton (light + dark) and add GetButtonState mapping enabled/pushed/hot state. - DirectionButtonAccessibleObject: derive Bounds from the shared GetButtonRectangle (client coords) and map via owner.RectangleToScreen. Classic (stacked) layout and rendering are unchanged. NumericUpDown and DomainUpDown inherit the new behavior. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 41e90924-3241-42a8-9556-71e100be7e59
Under a modern VisualStylesMode (Net11 or above) the up/down control now draws a single modern frame (the same rounded Fixed3D / flat FixedSingle chrome a stand-alone modern TextBox paints) around the whole control - both the edit and the side-by-side buttons - instead of the legacy themed single-textbox border that only wrapped the edit. - Add modern chrome geometry constants mirrored from TextBoxBase and a ModernBorderPadding helper (device-unit inset per BorderStyle). - PositionControls: split the modern layout into PositionControlsModern, which insets the edit and the (2x wide) button band by ModernBorderPadding so they sit inside the frame and clear the rounded corners; honors UpDownAlign/RTL. The classic layout is restored to its original, unchanged form. - OnPaint: in modern mode draw the frame via DrawModernBorder (corners filled with the parent back color so the rounded frame blends), skipping the themed/classic border path. - Add UpDownBaseTests covering the modern side-by-side layout geometry and that the modern paint path renders (DrawToBitmap) without throwing. Classic (non-modern) layout, rendering, and all existing UpDown tests are unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 41e90924-3241-42a8-9556-71e100be7e59
| continue | ||
| } | ||
|
|
||
| if ($arg.Equals('/p:Platform=arm64', [StringComparison]::OrdinalIgnoreCase) -or |
There was a problem hiding this comment.
This does not cover the case that we often use "-p:configuration=release;platform=x86". But you can ignore it if it is not used often in your case
43a34c3 to
f156625
Compare

Fixes #12207.
Refactored
build.cmdto delegate to a new PowerShell script (build.cmd.ps1) for improved argument parsing and platform detection.Added support for building on Windows ARM64 via the
-platform arm64option, which sets TargetArchitecture and disables NativeToolsOnMachine.Updated documentation to reflect the new ARM64 build instructions.
Microsoft Reviewers: Open in CodeFlow