* Don't tick with render loop when app is idle
* Update src/Avalonia.Base/Rendering/Composition/Transport/BatchStreamArrayPool.cs
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* wip
* wip
* api diff
* fixes
* Address review: clear wakeupPending at tick start, guard CarbonEmissionsHack subscriptions
- Clear _wakeupPending at start of TimerTick so wakeups already processed
by the current tick don't force an unnecessary extra tick
- Guard CarbonEmissionsHack against duplicate subscriptions using a private
attached property
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Fix lock-order inversion in Add/Remove vs TimerTick
Move Wakeup() and Stop() calls outside the _items lock in Add/Remove
to prevent deadlock with TimerTick which acquires _timerLock then _items.
Add/Remove are UI-thread-only so the extracted logic remains safe.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Address review: remove unused usings, guard double Stop(), fix SleepLoop extra frame
- Remove unused using directives from IRenderLoopTask.cs
- Guard TimerTick Stop() with _running check to prevent double Stop()
when Remove() already stopped the timer
- SleepLoopRenderTimer: use WaitOne(timeout) instead of Thread.Sleep
so Stop() can interrupt the sleep, and recheck _stopped before Tick
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Fix DisplayLinkTimer foreground handler bypassing render loop state
Only resume the display link on WillEnterForeground if the timer was
calling Start() to avoid setting _stopped=false when the render loop
had the timer stopped.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Fix DisplayLinkTimer thread safety, revert global NU5104 suppression
- Stop() now only sets _stopped flag; OnLinkTick() self-pauses the
CADisplayLink from the timer thread to avoid thread-affinity issues
- Revert NU5104 global suppression in SharedVersion.props
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Cap _ticksSinceLastCommit to prevent int overflow
Stop incrementing once it reaches CommitGraceTicks to prevent
wrapping negative and keeping the render loop awake indefinitely.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* refactor: remove Start/Stop from IRenderTimer, merge into Tick setter
Timer start/stop is now controlled entirely by setting the Tick
property: non-null starts, null stops. This eliminates the explicit
Start()/Stop() methods from IRenderTimer, making the API simpler.
DefaultRenderLoop controls the timer purely through Tick assignment
under its _timerLock. A new _hasItems flag tracks subscriber presence
since Tick is now transient (null when idle).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: address review comments on timer thread safety and guards
- ChoreographerTimer: add _frameCallbackActive guard to prevent double
PostFrameCallback from both Tick setter and SubscribeView
- ServerCompositor: cap _ticksSinceLastCommit at int.MaxValue
- SleepLoopRenderTimer: make _tick volatile, remove _stopped recheck
(guard moved to DefaultRenderLoop)
- DefaultRenderLoop: add _running check at tick start to drop late ticks
- ThreadProxyRenderTimer: add lock for internal state manipulation
- DisplayLinkTimer: add lock for all internal state manipulation
- Re-add NU5104 suppression to SharedVersion.props
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: make _hasItems volatile for cross-thread visibility
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: guard against redundant starts in DefaultRenderTimer, make _tick volatile across all timers
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Remove CarbonEmissionsHack, revert iOS/Android timers to always-ticking
- Delete CarbonEmissionsHack class and its XAML reference
- Revert DisplayLinkTimer (iOS) to original always-ticking implementation
- Revert ChoreographerTimer (Android) to original always-ticking implementation
- Add TODO comments for future start/stop on RenderLoop request
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Fix DirectCompositionConnection WaitOne not respecting process exit cancellation
Use WaitHandle.WaitAny with both _wakeEvent and cts.Token.WaitHandle so
the loop can exit when ProcessExit fires while the timer is stopped.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* timers
* XML docs
* Cache delegate
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Onboard onto Central Package Management
* Remove SharpDX
* Add back <clear /> to NuGet.config package source mapping
* Package mapping
* Inline props where appropriate
* Lost a space
* Update to xunit.v3
* Little more progress
* More fixes
* Keep VSTest supported
* Adjust Nuke
* Few fixes
* Fix for xunit 2
* Fix GetData override
* Adjust
* Use MTP for xunit 2
* Fix test
* Better fix
* --no-progress
* Few more fixes
* no progress
* Fix test
* Better fix
* TRX
* Move to Directory.Build.props
* Unify on MTP v2
* Update
* Update to stable
* 1.0.1
* 1.0.2
* Fix some warnings
* Fix more warnings
* Fix more warnings
* Add AnalyzerProject.targets targets
* PrivateAssets on Workspaces.Common
* Migrate AvaloniaNameSourceGenerator to IIncrementalGenerator
* Remove outdated lins in the generator readme
* Add GlobPattern.ToString
* Fix tests
* Formatting
* Redo pipeline, make steps more independent from each other, compilation should be reused between dependency changes
* Split XAML parsing and type resolution into separated steps
* Restore CompilationReferencesComparer usage
* Revert "Restore CompilationReferencesComparer usage"
This reverts commit c51341990b.
* Split ResolvedNamesProvider pipeline step, process files in parallel
* Add comment
* Switch back to EquatableList
* Add cancellation to the incremenetal source gen
* Rethrow cancellation exception
* Retarget to SkiaSharp 3.0
* Replace SKFilterQuality with SKSamplingOptions
* Replace obsolete GRBackendRenderTarget ctor
* Replace SkiaMetalApi reflection with stable APIs
* Use SKMatrix4x4 where it makes more sense perf wise
* Add CS0618 warning as error for Skia
* Fix ToSKSamplingOptions implementation
* Remove hacky compile time condition
* Update API compat
* Remove maccatalyst hack
---------
Co-authored-by: Julien Lebosquain <julien@lebosquain.net>
* Implement AVLN2208 diagnostic - ItemContainerInsideTemplate
* Add AVLN2208 tests
* Enable AVLN2208 as an error in the repository globally
* Fix invalid ListBoxItem inside of DataTemplate in devtools
* Add attribute
* Replace `SetLastError = true` with `Marshal.GetLastSystemError()`
* Make Avalonia.Base and Avalonia.Skia compatible with DisableRuntimeMarshalling
* First step in Android DisableRuntimeMarshalling support
* Make Avalonia.Browser compatible
* Set EnableRuntimeMarshalling=true on all projects we are not yet ready to support without runtime marshalling
If developers changed the nuget global packages folder by set NUGET_PACKAGES environment variable to a path without trailing slash, they may have a build error like this, refer to https://github.com/PrismLibrary/Prism/issues/2369
* Use UnconditionalSuppressMessage instead of #pragma in DefaultConverter
* Add missing DynamicallyAccessedMembers on WinRTInspectable
* Add missing UnconditionalSuppressMessage on Expression.OperatorName
* Use UnconditionalSuppressMessage instead of #pragma warning disable for all trimming warnings
* Don't even create ReflectionMethodAccessorPlugin if IsDynamicCodeSupported is false
* Remove old condition, as we are ready to be fully AOT compatible
* Fix duplicated trimming attributes warning in Markup.Xaml.Loader
* Fix nullability warnings
* Update ImageSharp to 2.1.8
* Removed obsolete attributes on ValueStore
* Ignore CA1815 on private API RenderTargetProperties
* Fix switch expression warnings
* Fix warnings in Vulkan project
* Only include PThread for WasmEnableThreads
* Rename pollfd to PollFd to fix CS8981
* Fix incompatible packages being used in ControlCatalog.Desktop
---------
Co-authored-by: Max Katz <maxkatz6@outlook.com>
* Ported the old Vulkan PR
* chop-chop
* Support for external objects in vulkan backend
* Fixed structure type
* Removed debug code
* sln fix
* Don't force vulkan on windows
* Use 2.88.8-preview.1.1 skiasharp
* Use SKImageFilter directly, as we don't need compat anymore
* Add SkiaSharp 3 render tests
* Enable SkiaSharp 3 tests on CI
* Add IncludeLinuxSkia in Skia tests
* Update Skia version, remove SkiaCompat
* Remove Skia3 test project, reuse single Skia render test project, so they won't conflict
* MVP SingleProject support for all supported platforms
* Convert MobileSandbox to be a single project
* WASM fixes
* Fix SDK CI version
* Use .NET 8 in build project as well
* Add EnableUnsafeBinaryFormatterSerialization
* Add macos workload, remove wasm-experimental
* And ios
* Specify TFM for single-project projects in dirs.proj
* Return deleted line
* Set PrivateAssets=all on MobileSandbox
* Add ios target only on non-linux in MobileSandbox
* Update after merges
* Update browser sub-project from the templates
* Don't build MobileSandbox on CI
* Couple of improvements
* Add android hack to run without manifest
* Add tvOS support and rearrange some properties
* Delete unusable Packages.targets file + related
* Add global Condition for AvaloniaSingleProject.targets
* Add .NET 8 target to packable projects
* Update test projects
* Update sample projects to target .NET 8
* Update main Avalonia package to target .NET 8 as well
* Remove MSBuildEnableWorkloadResolver hack and some minor change
* Use net8.0 in nuke build as well
* Pin 8.0.0 SDK
* Adjust API validation
* Pin a valid version
* Remove net461 target from Avalonia package
* Remove unused net6.0 target from Avalonia.Designer.HostApp
* Adjust API diff
* Update ControlCatalog.Android.csproj
* Remove MSBuildEnableWorkloadResolver
* Fix Browser issues on .NET 8
* Fix .NET 8 error
* Fix merge conflicts
* Replace explicit TFMs in .csproj files with a centralized registry
* Fix merge conflict
* Fix AvsLegacyWindowsTargetFrameworks and add hacks for the tests
* Update XCode project CommandLineArgument
---------
Co-authored-by: Nikita Tsukanov <keks9n@gmail.com>