Skip to content

fix: Map FileAccessMode to appropriate FileMode in StorageFile.OpenStreamAsync - #22796

Merged
MartinZikmund merged 8 commits into
masterfrom
dev/mazi/storagefile-stream
Jul 15, 2026
Merged

MartinZikmund merged 8 commits into
masterfrom
dev/mazi/storagefile-stream

Conversation

@MartinZikmund

@MartinZikmund MartinZikmund commented Mar 6, 2026 •

Copy link
Copy Markdown
Member

closes #21311

  • Understand the issue: StorageFile.Local.OpenStreamAsync uses FileMode.Open instead of mapping FileAccessMode to appropriate FileMode
  • Add a helper method ToFileMode to convert FileAccessMode to FileMode
  • Update OpenStreamAsync to use the correct FileMode based on FileAccessMode
    • Fixed in StorageFile.Local.cs (Skia, Desktop, etc.)
    • Fixed in StorageFile.iOS.cs (iOS security-scoped files)
  • Create a test to verify the fix
  • Build the changes successfully
  • Run tests to verify the fix works
    • ✓ Writing to non-existent file works (uses FileMode.OpenOrCreate)
    • ✓ Reading from non-existent file throws FileNotFoundException (uses FileMode.Open)
  • Add XML documentation to ToFileMode method
  • Fix formatting issues (remove trailing whitespace)
Original prompt

This section details on the original issue you should resolve

<issue_title>StorageFile.Local.OpenStreamAsync always use File.Open instead of the FileAccessMode argument</issue_title>
<issue_description>### Current behavior 🐛

FileNotFoundException thrown when trying to write new StorageFile in a Skia.Desktop Mac app.

Image

Expected behavior 🎯

No exception thrown with correct entitlements or choice of output folder

How to reproduce it (as minimally and precisely as possible) 🔬

Demo project: https://github.com/baskren/MacDesktop_StorageFile_Write

Relevant configurations:

entitlements.plist [CLICK HERE TO EXPAND]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
	<dict>
		<key>com.apple.security.cs.allow-jit</key>
		<true/>
		<key>com.apple.security.files.user-selected.read-write</key>
		<true/>
		<key>com.apple.security.files.downloads</key>
		<true/>
		<key>com.apple.security.files.documents</key>
		<true/>
	</dict>
</plist>
  • Tried adding either/or/both of the following to the project's .csproj, in the <Properties> group:
<CodesignEntitlements Condition=" $(TargetFramework.Contains('desktop')) " >Platforms/Desktop/MacOS/entitlements.plist</CodesignEntitlements>
<UnoMacOSEntitlements Condition=" $(TargetFramework.Contains('desktop')) " >Platforms/Desktop/MacOS/entitlements.plist</UnoMacOSEntitlements>

Workaround 🛠️

None known at this time

Renderer 🎨

  • Skia
  • Native

Affected platforms 📱💻🖥️

Desktop (macOS)

Uno.Sdk version (and other relevant versions) 📦

Uno.Sdk: 6.1.23

UnoFeatures:

  • CSharpMarkup;
  • Lottie;
  • Hosting;
  • Toolkit;
  • Configuration;
  • Localization;
  • ThemeService;
  • SkiaRenderer;

IDE version 🧑‍💻

Click to expand [Mac Dev Environment]

JetBrains Rider

JetBrains Rider 2025.2
Build #RD-252.23892.524, built on August 12, 2025
Source revision: 18364647ddbb4
Licensed to Ben Askren
Subscription is active until July 10, 2026.
Runtime version: 21.0.7+6-b1038.58 aarch64 (JCEF 122.1.9)
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Toolkit: sun.lwawt.macosx.LWCToolkit
macOS 15.6
.NET Core v8.0.11 ARM64 (Server GC)
GC: G1 Young Generation, G1 Concurrent GC, G1 Old Generation
Memory: 4096M
Cores: 12
Metal Rendering is ON
Registry:
ide.lookup.shrink=true
ide.experimental.ui=true
llm.show.ai.promotion.window.on.start=false
Non-Bundled Plugins:
org.antlr.intellij.plugin (1.24)
com.intellij.resharper.HeapAllocationsViewer (2025.1.0)
com.intellij.copyright (252.23892.464)
com.redhat.devtools.lsp4ij (0.14.2)
lermitage.intellij.iconviewer (1.31.3)
com.github.camork.fileExpander (2.5)
com.wakatime.intellij.plugin (15.0.4)
com.cppcxy.Intellij-SumnekoLua (3.15.0.46-IDEA243)
com.jetbrains.rider.android (252.23892.524)
unoplatform (1.5.19)
Karma (252.25204.0)
me.rafaelldi.aspire (1.8.8)
com.intellij.resharper.azure (4.5.3)

Anything else we need to know? 💬

No response</issue_description>

Comments on the Issue (you are @copilot in this section)

@spouliot https://github.com/baskren/MacDesktop_StorageFile_Write is a 404. Is it public ? @spouliot Your `entitlements.plist` above does not match the one inside the repo.

However that's not the problem. Entitlements are only needed if/when the app is packaged as an app bundle (and in the case of this entitlement the app would have to be sandboxed to need this).

For a dotnet app the file system is accessible with the same permission that the current user (launching the app) has.

The full exception is:

   at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirError)
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, UnixFileMode openPermissions, Int64& fileLength, UnixFileMode& filePermissions, Boolean failForSymlink, Boolean& wasSymlink, Func`4 createOpenException)
   at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
   at System.IO.File.Open(String path, FileMode mode, FileAccess access, FileShare share)
   at Windows.Storage.StorageFile.Local.OpenStreamAsync(CancellationToken ct, FileAccessMode accessMode, StorageOpenOptions options) in C:\a\1\s\src\Uno.UWP\Storage\StorageFile.Local.cs:line 43
   at Windows.Storage.StorageFile.OpenStream(CancellationToken ct, FileAccessMode accessMode, StorageOpenOption...

</details>

Fixes unoplatform/uno#21311

<!-- START COPILOT CODING AGENT TIPS -->
---

💬 We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://survey3.medallia.com/?EAHeSx-AP01bZqG0Ld9QLQ).

Copilot AI review requested due to automatic review settings March 6, 2026 20:48
@github-actions github-actions Bot added the platform/ios 🍎 Categorizes an issue or PR as relevant to the iOS platform label Mar 6, 2026
@CLAassistant

CLAassistant commented Mar 6, 2026 •

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ MartinZikmund
❌ Copilot
You have signed the CLA already but the status is still pending? Let us recheck it.

@mergify

mergify Bot commented Mar 6, 2026

Copy link
Copy Markdown
Contributor

⚠️ The sha of the head commit of this PR conflicts with #21663. Mergify cannot evaluate rules on this PR. Once #21663 is merged or closed, Mergify will resume processing this PR. ⚠️

@MartinZikmund MartinZikmund changed the title fix: Stream open fix: Map FileAccessMode to appropriate FileMode in StorageFile.OpenStreamAsync Mar 6, 2026
@MartinZikmund
MartinZikmund enabled auto-merge March 6, 2026 20:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts Uno’s StorageFile stream-opening behavior so write access can create missing files (instead of failing with FileNotFoundException), and adds a runtime test to cover the scenario.

Changes:

  • Introduce a ToFileMode(FileAccessMode) helper to map Read→FileMode.Open and ReadWrite→FileMode.OpenOrCreate.
  • Update iOS (security-scoped) and local OpenStreamAsync implementations to use the new ToFileMode mapping.
  • Add a runtime test validating OpenStreamForWriteAsync() on a path that doesn’t exist yet.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/Uno.UWP/Storage/StorageFile.iOS.cs Use FileMode.OpenOrCreate for ReadWrite stream opens via ToFileMode.
src/Uno.UWP/Storage/StorageFile.cs Add ToFileMode(FileAccessMode) helper (shared mapping).
src/Uno.UWP/Storage/StorageFile.Local.cs Use ToFileMode in local OpenStreamAsync to allow creating missing files on write.
src/Uno.UI.RuntimeTests/Tests/Windows_Storage/Given_StorageFile_Native.base.cs Add runtime test for OpenStreamForWriteAsync() when the file doesn’t exist.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 200351 found UI Test snapshots differences: android-28-net9: 17, android-28-net9-Snap: 21, ios: 2, ios-Snap: 41, skia-linux-screenshots: 52, skia-windows-screenshots: 61, wasm: 128, wasm-automated-net10.0-WinUI-Benchmarks-automated: 0, wasm-automated-net10.0-WinUI-Default-automated: 13, wasm-automated-net10.0-WinUI-RuntimeTests-0: 0, wasm-automated-net10.0-WinUI-RuntimeTests-1: 0, wasm-automated-net10.0-WinUI-RuntimeTests-2: 0

Details
  • android-28-net9: 17 changed over 758

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • DecimalFormatterTest_UITests_Shared_Microsoft_UI_Xaml_Controls_NumberBoxTests_NumberBoxPage
    • Detereminate_ProgressRing_Validation75_[#FF0000_#008000_#008000_#008000]_Progress-Ring-Value-75
    • NativeCommandBar_Size_Uno_UI_Samples_Content_UITests_CommandBar_CommandBar_Dynamic
    • ProgressRing_IsEnabled_Running_UITests_Windows_UI_Xaml_Controls_ProgressRing_WindowsProgressRing_GH1220
    • When_MultipleSelectionWithoutItemClick_Then_PointersEvents_UITests_Windows_UI_Xaml_Controls_ListView_ListView_Selection_Pointers
    • WebView_NavigateToAnchor_Initial
    • When_SingleSelectionWithItemClick_Then_PointersEvents_UITests_Windows_UI_Xaml_Controls_ListView_ListView_Selection_Pointers
    • When_SingleSelectionWithoutItemClick_Then_PointersEvents_UITests_Windows_UI_Xaml_Controls_ListView_ListView_Selection_Pointers
    • When_Parent_PointerMoved_After_drag_on_non-scrolling_ScrollViewer
    • When_Parent_PointerMoved_After_drag_on_ScrollViewer_-_touch
    • When_NoSelectionWithItemClick_Then_PointersEvents_UITests_Windows_UI_Xaml_Controls_ListView_ListView_Selection_Pointers
    • When_NoSelection_Then_PointersEvents_UITests_Windows_UI_Xaml_Controls_ListView_ListView_Selection_Pointers
    • Detereminate_ProgressRing_Validation25_[#FF0000_#008000_#FF0000_#FF0000]_Progress-Ring-Value-25
    • ListView_ListViewWithHeader_InitializesTest_SamplesApp_Windows_UI_Xaml_Controls_ListView_HorizontalListViewGrouped
    • SequentialAnimations_SamplesApp_Windows_UI_Xaml_Media_Animation_SequentialAnimationsPage
    • ProgressRing_Visibility_Collapsed_UITests_Windows_UI_Xaml_Controls_ProgressRing_WindowsProgressRing_GH1220
    • ListView_SelectedItems_SamplesApp_Windows_UI_Xaml_Controls_ListView_ListViewSelectedItems
  • android-28-net9-Snap: 21 changed over 1067

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Gesture_Recognizer_Pointer_Events_test_bench_UITests_Shared_Windows_UI_Input_GestureRecognizer_PointersEvents
    • Image_UITests_Windows_UI_Xaml_Controls_ImageTests_SvgImageSource_Icons_UITests_Windows_UI_Xaml_Controls_ImageTests_SvgImageSource_Icons
    • CommandBar_Examples_Uno_UI_Samples_Content_UITests_CommandBar_CommandBar_Examples
    • Default_Uno_UI_Samples_Content_UITests_WebView_WebView_AnchorNavigation_Uno_UI_Samples_Content_UITests_WebView_WebView_AnchorNavigation
    • Scrolling_MUXControlsTestApp_ScrollViewKeyboardAndGamepadNavigationPage_MUXControlsTestApp_ScrollViewKeyboardAndGamepadNavigationPage
    • ListView_ListViewSelectedItems_SamplesApp_Windows_UI_Xaml_Controls_ListView_ListViewSelectedItems
    • MediaPlayerElement_Mini_player_UITests_Shared_Windows_UI_Xaml_Controls_MediaPlayerElement_MediaPlayerElement_Minimal
    • MediaPlayerElement_Using_ogg_UITests_Shared_Windows_UI_Xaml_Controls_MediaPlayerElement_MediaPlayerElement_Ogg_Extension
    • Scrolling_MUXControlsTestApp_ScrollViewWithScrollControllersPage_MUXControlsTestApp_ScrollViewWithScrollControllersPage
    • MUX_UITests_Shared_Microsoft_UI_Xaml_Controls_TreeViewTests_TreeViewPage_UITests_Shared_Microsoft_UI_Xaml_Controls_TreeViewTests_TreeViewPage
    • NavigationView_MUXControlsTestApp_NavigationViewTopNavOnlyPage_MUXControlsTestApp_NavigationViewTopNavOnlyPage
    • TabView_MUXControlsTestApp_TabViewPage_MUXControlsTestApp_TabViewPage
    • TeachingTip_UITests_Microsoft_UI_Xaml_Controls_TeachingTipTests_TeachingTipPage_UITests_Microsoft_UI_Xaml_Controls_TeachingTipTests_TeachingTipPage
    • CommandBarFlyout_MUXControlsTestApp_CommandBarFlyoutPage_MUXControlsTestApp_CommandBarFlyoutPage
    • Transform_Basics_UITests_Shared_Windows_UI_Xaml_Media_Transform_Basics
    • MUX_NumberBox_UITests_Shared_Microsoft_UI_Xaml_Controls_NumberBoxTests_NumberBoxPage
    • Scrolling_MUXControlsTestApp_ScrollViewDynamicPage_MUXControlsTestApp_ScrollViewDynamicPage
    • WebView_Javascript_AlertConfirmPrompt_Uno_UI_Samples_Content_UITests_WebView_WebViewControlJavaScriptAlertConfirmPrompt
    • WebView_UITests_Microsoft_UI_Xaml_Controls_WebView2Tests_WebView2_NavigationProperties_UITests_Microsoft_UI_Xaml_Controls_WebView2Tests_WebView2_NavigationProperties
    • NavigationView_MUXControlsTestApp_NavigationViewRS4Page_MUXControlsTestApp_NavigationViewRS4Page
  • ios: 2 changed over 213

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ProgressRing_Visibility_Collapsed_UITests_Windows_UI_Xaml_Controls_ProgressRing_WindowsProgressRing_GH1220
    • ProgressRing_IsEnabled_Running_UITests_Windows_UI_Xaml_Controls_ProgressRing_WindowsProgressRing_GH1220
  • ios-Snap: 41 changed over 986

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Brushes_UITests_Shared_Windows_UI_Xaml_Media_ImageBrushTests_ImageBrush_SameWithDelay_UITests_Shared_Windows_UI_Xaml_Media_ImageBrushTests_ImageBrush_SameWithDelay
    • ColorPicker_ColorPickerSample_UITests_Microsoft_UI_Xaml_Controls_ColorPickerTests_ColorPickerSample
    • ColorPicker_WinUIColorPickerPage_UITests_Shared_Microsoft_UI_Xaml_Controls_ColorPickerTests_WinUIColorPickerPage
    • Performance_UITests_Windows_UI_Xaml_Performance_Performance_1000ButtonsContinuousRendering_UITests_Windows_UI_Xaml_Performance_Performance_1000ButtonsContinuousRendering
    • Microsoft_UI_Composition_UITests_Windows_UI_Composition_MixTransformCliPropertyAndClippedByParentWithBorders_Then_RenderingIsValid_UITests_Windows_UI_Composition_MixTransformCliPropertyAndClippedByParentWithBorders_Then_RenderingIsValid
    • Brushes_ImageBrushLocalAsset_Uno_UI_Samples_UITests_ImageBrushTestControl_ImageBrushLocalAsset
    • NavigationView_MUXControlsTestApp_NavigationViewMenuItemStretchPage_MUXControlsTestApp_NavigationViewMenuItemStretchPage
    • NavigationView_MUXControlsTestApp_NavigationViewMinimalPage_MUXControlsTestApp_NavigationViewMinimalPage
    • TextBlock_UITests_Windows_UI_Xaml_Controls_TextBlockControl_TextBlock_RelativeTextSize_UITests_Windows_UI_Xaml_Controls_TextBlockControl_TextBlock_RelativeTextSize
    • ContentControl_Uno_UI_Samples_Content_UITests_ContentControlTestsControl_ContentControl_Nested_TemplatedParent_Uno_UI_Samples_Content_UITests_ContentControlTestsControl_ContentControl_Nested_TemplatedParent
    • Icons_UITests_Microsoft_UI_Xaml_Controls_ImageIconTests_ImageIconPage_UITests_Microsoft_UI_Xaml_Controls_ImageIconTests_ImageIconPage
    • Icons_UITests_Shared_Windows_UI_Xaml_Controls_BitmapIconTests_BitmapIcon_Foreground_UITests_Shared_Windows_UI_Xaml_Controls_BitmapIconTests_BitmapIcon_Foreground
    • WebView_UITests_Microsoft_UI_Xaml_Controls_WebViewTests_WebView_InvokeScriptAsync_UITests_Microsoft_UI_Xaml_Controls_WebViewTests_WebView_InvokeScriptAsync
    • Image_Uno_UI_Samples_UITests_Image_Image_Stretch_Alignment_Bigger_Uno_UI_Samples_UITests_Image_Image_Stretch_Alignment_Bigger
    • Image_Uno_UI_Samples_UITests_Image_Image_Stretch_Alignment_Equal_Uno_UI_Samples_UITests_Image_Image_Stretch_Alignment_Equal
    • Image_Uno_UI_Samples_UITests_Image_Image_Stretch_Alignment_Smaller_Uno_UI_Samples_UITests_Image_Image_Stretch_Alignment_Smaller
    • MediaPlayerElement_Using_ogg_UITests_Shared_Windows_UI_Xaml_Controls_MediaPlayerElement_MediaPlayerElement_Ogg_Extension
    • MenuBar_SimpleMenuBar_UITests_Shared_Windows_UI_Xaml_Controls_MenuBarTests_SimpleMenuBar
    • Grid_UITests_Windows_UI_Xaml_Controls_GridTestsControl_Grid_DynamicRowColumn_UITests_Windows_UI_Xaml_Controls_GridTestsControl_Grid_DynamicRowColumn
    • Windows_ApplicationModel_Contacts_Pick_UITests_Windows_ApplicationModel_Contacts_PickContact
  • skia-linux-screenshots: 52 changed over 2316

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • DoubleImageBrushInList.png-dark
    • DoubleImageBrushInList.png
    • CalendarView_Theming.png-dark
    • ButtonClippingTestsControl.png-dark
    • DisplayInformation.png-dark
    • Buttons.png-dark
    • DropDownButtonPage.png-dark
    • Focus_FocusVisual_Properties.png-dark
    • Focus_FocusVisual_Properties.png
    • Buttons.png
    • ColorPickerSample.png-dark
    • Gamepad_CurrentReading.png-dark
    • Gamepad_CurrentReading.png
    • Gamepad_Enumeration.png-dark
    • Gamepad_Enumeration.png
    • CalendarView_Theming.png
    • ClipboardTests.png-dark
    • ColorPickerSample.png
    • Examples.png-dark
    • Examples.png
  • skia-windows-screenshots: 61 changed over 2318

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Focus_FocusVisual_Properties.png-dark
    • Focus_FocusVisual_Properties.png
    • Buttons.png-dark
    • Buttons.png
    • Image_Margin_Large.png-dark
    • Image_Margin_Large.png
    • ButtonClippingTestsControl.png-dark
    • ContentPresenter_TextProperties.png-dark
    • ContentPresenter_TextProperties.png
    • DisplayInformation.png-dark
    • DisplayInformation.png
    • EllipsemaskingEllipseGrid.png-dark
    • EllipsemaskingEllipseGrid.png
    • Gamepad_CurrentReading.png-dark
    • Gamepad_CurrentReading.png
    • Gamepad_Enumeration.png-dark
    • Image_Stretch_None.png-dark
    • Image_Stretch_None.png
    • DropDownButtonPage.png-dark
    • DropDownButtonPage.png
  • wasm: 128 changed over 1066

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • SamplesApp.Wasm.Windows_UI_Xaml_Controls.ListView.ListView_IsSelected
    • SamplesApp.Windows_UI_Xaml_Controls.ListView.ListViewLegacy
    • SamplesApp.Windows_UI_Xaml_Controls.ListView.ListView_Padding_Unconstrained
    • UITests.Shared.Microsoft_UI_Xaml_Controls.ExpanderTests.WinUIExpanderPage
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Minimal
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Ogg_Extension
    • UITests.Windows_UI_Xaml_Controls.ListView.ListViewItem_Click_Focus
    • UITests.Windows_UI_Xaml_Controls.ListView.ListView_DuplicateItem
    • MUXControlsTestApp.ScrollViewPage
    • SamplesApp.Samples.UnitTests.HttpUnitTests
    • UITests.Shared.Windows_Devices.Midi.MidiDeviceEnumerationTests
    • UITests.Shared.Windows_UI_Xaml_Controls.PasswordBoxTests.PasswordBoxPage
    • UITests.Shared.Windows_UI_Xaml_Controls.Popup.MessageDialog
    • UITests.Shared.Windows_UI_Xaml_Shapes.MeasurePage
    • UITests.Windows_UI_Xaml.Clipping.CornerRadiusControls
    • UITests.Windows_UI_Xaml_Controls.Repeater.ItemsRepeater_Nested
    • UITests.Windows_UI_Xaml_Shapes.Shapes_Default_StrokeThickness
    • MUXControlsTestApp.SelectorBarSamplePage
    • SamplesApp.Wasm.Windows_UI_Xaml_Controls.ComboBox.ComboBox_CornerRadius
    • SamplesApp.Windows_UI_Xaml_Controls.ListView.ListView_Changing_Text
  • wasm-automated-net10.0-WinUI-Benchmarks-automated: 0 changed over 1

  • wasm-automated-net10.0-WinUI-Default-automated: 13 changed over 877

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ListView_SelectedItems_SamplesApp_Windows_UI_Xaml_Controls_ListView_ListViewSelectedItems
    • TestProgressRing_InitialState_UITests_Microsoft_UI_Xaml_Controls_ProgressRing_WinUIProgressRing_Features
    • Validate_Offscreen_Shapes_UITests_Windows_UI_Xaml_Shapes_Offscreen_Shapes
    • Default_StrokeThickness_MyLine
    • Default_StrokeThickness_MyPath
    • Default_StrokeThickness_MyEllipse
    • Default_StrokeThickness_MyRect
    • When_NoSelectionWithItemClick_Then_PointersEvents_UITests_Windows_UI_Xaml_Controls_ListView_ListView_Selection_Pointers
    • Default_StrokeThickness_MyPolyline
    • SequentialAnimations_SamplesApp_Windows_UI_Xaml_Media_Animation_SequentialAnimationsPage
    • Default_StrokeThickness_MyPolygon
    • When_ExtendedSelectionWithoutItemClick_Then_PointersEvents_UITests_Windows_UI_Xaml_Controls_ListView_ListView_Selection_Pointers
    • When_TransformToVisual_ScrollViewer_UITests_Shared_Windows_UI_Xaml_UIElementTests_TransformToVisual_ScrollViewer
  • wasm-automated-net10.0-WinUI-RuntimeTests-0: 0 changed over 1

  • wasm-automated-net10.0-WinUI-RuntimeTests-1: 0 changed over 1

  • wasm-automated-net10.0-WinUI-RuntimeTests-2: 0 changed over 1

@MartinZikmund
MartinZikmund force-pushed the dev/mazi/storagefile-stream branch from f8c0a80 to e9f6c24 Compare March 9, 2026 12:11
@MartinZikmund MartinZikmund added the ready-to-merge Automatically merge the PR once all '.mergify.yml' policies are met label Mar 9, 2026
@nventive-devops

Copy link
Copy Markdown
Contributor

The build 200524 found UI Test snapshots differences: android-28-net9: 18, android-28-net9-Snap: 29, ios: 3, ios-Snap: 49, skia-linux-screenshots: 60, skia-windows-screenshots: 76, wasm: 135, wasm-automated-net10.0-WinUI-Benchmarks-automated: 0, wasm-automated-net10.0-WinUI-Default-automated: 14, wasm-automated-net10.0-WinUI-RuntimeTests-0: 0, wasm-automated-net10.0-WinUI-RuntimeTests-1: 0, wasm-automated-net10.0-WinUI-RuntimeTests-2: 0

Details
  • android-28-net9: 18 changed over 758

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Detereminate_ProgressRing_Validation25_[#FF0000_#008000_#FF0000_#FF0000]_Progress-Ring-Value-25
    • Detereminate_ProgressRing_Validation50_[#FF0000_#008000_#008000_#FF0000]_Progress-Ring-Value-50
    • ProgressRing_Visibility_Collapsed_UITests_Windows_UI_Xaml_Controls_ProgressRing_WindowsProgressRing_GH1220
    • ListView_SelectedItems_SamplesApp_Windows_UI_Xaml_Controls_ListView_ListViewSelectedItems
    • ProgressRing_IsEnabled_Running_UITests_Windows_UI_Xaml_Controls_ProgressRing_WindowsProgressRing_GH1220
    • UpDownEnabledTest_UITests_Shared_Microsoft_UI_Xaml_Controls_NumberBoxTests_NumberBoxPage
    • When_MultipleSelectionWithoutItemClick_Then_PointersEvents_UITests_Windows_UI_Xaml_Controls_ListView_ListView_Selection_Pointers
    • When_SingleSelectionWithItemClick_Then_PointersEvents_UITests_Windows_UI_Xaml_Controls_ListView_ListView_Selection_Pointers
    • When_NoSelectionWithItemClick_Then_PointersEvents_UITests_Windows_UI_Xaml_Controls_ListView_ListView_Selection_Pointers
    • When_Parent_PointerMoved_After_drag_on_ScrollViewer_-_touch
    • DecimalFormatterTest_UITests_Shared_Microsoft_UI_Xaml_Controls_NumberBoxTests_NumberBoxPage
    • FocusManager_GetFocusedElement_HyperlinkButton_Validation_FocusManager_-_GetFocusedElement_-_HyperlinkButton_-_2_-_Click_outside
    • FocusManager_GetFocusedElement_HyperlinkButton_Validation_Uno_UI_Samples_Content_UITests_FocusTests_FocusManager_GetFocus_Automated
    • When_ExtendedSelectionWithoutItemClick_Then_PointersEvents_UITests_Windows_UI_Xaml_Controls_ListView_ListView_Selection_Pointers
    • FocusManager_GetFocusedElement_HyperlinkButton_Validation_FocusManager_-_GetFocusedElement_-_HyperlinkButton_-_1_-_Initial_State
    • NativeCommandBar_Size_Uno_UI_Samples_Content_UITests_CommandBar_CommandBar_Dynamic
    • Detereminate_ProgressRing_Validation75_[#FF0000_#008000_#008000_#008000]_Progress-Ring-Value-75
    • WebView_NavigateToAnchor_Uno_UI_Samples_Content_UITests_WebView_WebView_AnchorNavigation
  • android-28-net9-Snap: 29 changed over 1067

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • MUX_NumberBox_UITests_Shared_Microsoft_UI_Xaml_Controls_NumberBoxTests_NumberBoxPage
    • Image_UITests_Windows_UI_Xaml_Controls_ImageTests_SvgImageSource_Icons_UITests_Windows_UI_Xaml_Controls_ImageTests_SvgImageSource_Icons
    • ListView_ListView_With_ListViews_Count_Measure_UITests_Shared_Windows_UI_Xaml_Controls_ListView_ListView_With_ListViews_Count_Measure
    • NavigationView_MUXControlsTestApp_NavigationViewRS4Page_MUXControlsTestApp_NavigationViewRS4Page
    • Projection_PlaneProjection_Basic_UITests_Shared_Windows_UI_Xaml_Media_Projection_PlaneProjection_Basic
    • CommandBarFlyout_MUXControlsTestApp_CommandBarFlyoutPage_MUXControlsTestApp_CommandBarFlyoutPage
    • Scrolling_MUXControlsTestApp_ScrollViewKeyboardAndGamepadNavigationPage_MUXControlsTestApp_ScrollViewKeyboardAndGamepadNavigationPage
    • Transform_Basics_UITests_Shared_Windows_UI_Xaml_Media_Transform_Basics
    • Image_UniformToFill100x100_Uno_UI_Samples_UITests_ImageTestsControl_UniformToFill100x100
    • MediaPlayerElement_Mini_player_UITests_Shared_Windows_UI_Xaml_Controls_MediaPlayerElement_MediaPlayerElement_Minimal
    • MediaPlayerElement_Using_ogg_UITests_Shared_Windows_UI_Xaml_Controls_MediaPlayerElement_MediaPlayerElement_Ogg_Extension
    • Scrolling_MUXControlsTestApp_ScrollViewDynamicPage_MUXControlsTestApp_ScrollViewDynamicPage
    • ListView_ListViewSelectedItems_SamplesApp_Windows_UI_Xaml_Controls_ListView_ListViewSelectedItems
    • TabView_MUXControlsTestApp_TabViewPage_MUXControlsTestApp_TabViewPage
    • WebView_WebView2_Mailto_SamplesApp_Microsoft_UI_Xaml_Controls_WebView2Tests_WebView2_Mailto
    • WebView_WebView2_NavigateToUri_SamplesApp_Microsoft_UI_Xaml_Controls_WebView2Tests_WebView2_NavigateToUri
    • NavigationView_MUXControlsTestApp_NavigationViewTopNavOnlyPage_MUXControlsTestApp_NavigationViewTopNavOnlyPage
    • NavigationView_MUXControlsTestApp_NavigationViewTopNavPage_MUXControlsTestApp_NavigationViewTopNavPage
    • CommandBar_Examples_Uno_UI_Samples_Content_UITests_CommandBar_CommandBar_Examples
    • MUX_UITests_Shared_Microsoft_UI_Xaml_Controls_TreeViewTests_TreeViewPage_UITests_Shared_Microsoft_UI_Xaml_Controls_TreeViewTests_TreeViewPage
  • ios: 3 changed over 213

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Check_ListView_Swallows_Measure_UITests_Shared_Windows_UI_Xaml_Controls_ListView_ListView_With_ListViews_Count_Measure
    • ProgressRing_Visibility_Collapsed_UITests_Windows_UI_Xaml_Controls_ProgressRing_WindowsProgressRing_GH1220
    • ProgressRing_IsEnabled_Running_UITests_Windows_UI_Xaml_Controls_ProgressRing_WindowsProgressRing_GH1220
  • ios-Snap: 49 changed over 986

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Brushes_GenericApp_Views_Content_UITests_ImageBrushTestControl_ImageBrush_UniformToFill_GenericApp_Views_Content_UITests_ImageBrushTestControl_ImageBrush_UniformToFill
    • Grid_Grid_DataBound_ColumnRow_Definitions_Uno_UI_Samples_Content_UITests_GridTestsControl_Grid_DataBound_ColumnRow_Definitions
    • Icons_UITests_Microsoft_UI_Xaml_Controls_ImageIconTests_ImageIconPage_UITests_Microsoft_UI_Xaml_Controls_ImageIconTests_ImageIconPage
    • Icons_UITests_Shared_Windows_UI_Xaml_Controls_BitmapIconTests_BitmapIcon_Foreground_UITests_Shared_Windows_UI_Xaml_Controls_BitmapIconTests_BitmapIcon_Foreground
    • Microsoft_UI_Xaml_Media_UITests_Windows_UI_Xaml_Media_ThemeShadowTests_ThemeShadow_Overlap_UITests_Windows_UI_Xaml_Media_ThemeShadowTests_ThemeShadow_Overlap
    • TextBox_Input_InputScope_CurrencyAmount_Uno_UI_Samples_Content_UITests_TextBoxControl_Input_InputScope_CurrencyAmount
    • Brushes_BorderImageBrush_Uno_UI_Samples_UITests_ImageBrushTestControl_BorderImageBrush
    • Brushes_ImageBrush_Stretch_None_Uno_UI_Samples_UITests_ImageBrushTestControl_ImageBrush_Stretch_None
    • Grid_CenteredGridinGridwiththreefixedsizechildren_Uno_UI_Samples_Content_UITests_GridTestsControl_CenteredGridinGridwiththreefixedsizechildren
    • Flyouts_UITests_Windows_UI_Xaml_Controls_Flyout_Flyout_TemplatedParent_UITests_Windows_UI_Xaml_Controls_Flyout_Flyout_TemplatedParent
    • MediaPlayerElement_Using_ogg_UITests_Shared_Windows_UI_Xaml_Controls_MediaPlayerElement_MediaPlayerElement_Ogg_Extension
    • NavigationView_FluentStyle_NavigationViewSample_SamplesApp_Samples_Microsoft_UI_Xaml_Controls_NavigationViewTests_FluentStyle_FluentStyle_NavigationViewSample
    • UIElement_TransformToVisual_Simple_UITests_Shared_Windows_UI_Xaml_UIElementTests_TransformToVisual_Simple
    • Windows_Networking_NetworkInformation_UITests_Windows_Networking_NetworkInformationTests
    • ColorPicker_ColorPickerSample_UITests_Microsoft_UI_Xaml_Controls_ColorPickerTests_ColorPickerSample
    • Default_SamplesApp_Wasm_Windows_UI_Xaml_Controls_ListView_ListView_IsSelected_SamplesApp_Wasm_Windows_UI_Xaml_Controls_ListView_ListView_IsSelected
    • Default_Uno_UI_Samples_Content_UITests_WebView_WebView_AnchorNavigation_Uno_UI_Samples_Content_UITests_WebView_WebView_AnchorNavigation
    • Default_Uno_UI_Samples_UITests_Image_Image_Margin_Uno_UI_Samples_UITests_Image_Image_Margin
    • MediaPlayerElement_Mini_player_UITests_Shared_Windows_UI_Xaml_Controls_MediaPlayerElement_MediaPlayerElement_Minimal
    • NavigationView_MUXControlsTestApp_NavigationViewRS4Page_MUXControlsTestApp_NavigationViewRS4Page
  • skia-linux-screenshots: 60 changed over 2316

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Gamepad_Enumeration.png-dark
    • Gamepad_Enumeration.png
    • Focus_FocusVisual_Properties.png-dark
    • Focus_FocusVisual_Properties.png
    • ButtonClippingTestsControl.png-dark
    • DisplayInformation.png-dark
    • CompositionEffectBrush.png-dark
    • CompositionEffectBrush.png
    • ImageBrush_Stretch.png-dark
    • ImageBrush_Stretch.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • Image_Stretch_None.png-dark
    • Image_Stretch_None.png
    • DoubleImageBrushInList.png-dark
    • DoubleImageBrushInList.png
    • ImageIconPage.png-dark
    • ImageIconPage.png
    • Buttons.png-dark
    • Gamepad_CurrentReading.png-dark
  • skia-windows-screenshots: 76 changed over 2318

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ContentPresenter_Template.png-dark
    • ContentPresenter_Template.png
    • DisplayInformation.png-dark
    • ContentPresenter_TextProperties.png-dark
    • ContentPresenter_TextProperties.png
    • Examples.png-dark
    • Examples.png
    • Gamepad_CurrentReading.png-dark
    • Gamepad_CurrentReading.png
    • ClipboardTests.png-dark
    • ButtonClippingTestsControl.png-dark
    • CalendarView_Theming.png
    • DropDownButtonPage.png-dark
    • DropDownButtonPage.png
    • HierarchicalNavigationViewMarkup.png-dark
    • HierarchicalNavigationViewMarkup.png
    • Image_Stretch_None.png-dark
    • Image_Stretch_None.png
    • Buttons.png
    • Buttons.png-dark
  • wasm: 135 changed over 1066

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • initial_state
    • MUXControlsTestApp.PipsPagerPage
    • SamplesApp.Windows_UI_Xaml_Controls.ListView.ListViewHeaderFooter_ImplicitlyBinded
    • UITests.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_NavigationProperties
    • UITests.Shared.Windows_UI_Xaml_Controls.ListView.ListView_With_ListViews_Count_Measure
    • UITests.Shared.Windows_UI_Xaml_Media.Transform.Basics_Automated
    • UITests.Shared.Windows_UI_Xaml_Media.Transform.List_With_Transformed_Ancestor
    • UITests.Windows_UI_Xaml.UIElementTests.UIElement_ArrangeOverride_Alignment
    • UITests.Windows_UI_Xaml_Controls.TextBox.WASM_Multiline
    • MUXControlsTestApp.ScrollViewPage
    • UITests.Shared.Windows_UI_Xaml_Controls.ComboBox.ComboBox_SelectedIndex
    • SamplesApp.Windows_UI_Xaml_Controls.ListView.ListViewMarginTest
    • SamplesApp.Windows_UI_Xaml_Controls.ListView.ListViewResizable
    • UITests.Shared.Windows_UI_Xaml_Controls.ListView.ListView_ObservableCollection_Unused_Space
    • SamplesApp.Windows_UI_Xaml_Controls.ListView.ListView_Padding_Unconstrained
    • UITests.Shared.Windows_UI_Xaml_Controls.TextBlockControl.SimpleText_MaxLines_Different_Font_Size
    • UITests.Shared.Windows_UI_Xaml_Controls.TimePicker.TimePicker_Flyout_Automated_Reload
    • UITests.Shared.Windows_UI_Xaml_Media_Animation.SetTargetProperty
    • UITests.Shared.Windows_UI_Xaml_Controls.Button.Button_Events
    • UITests.Windows_UI_Xaml.FrameworkElementTests.FrameworkElement_Sizes
  • wasm-automated-net10.0-WinUI-Benchmarks-automated: 0 changed over 1

  • wasm-automated-net10.0-WinUI-Default-automated: 14 changed over 877

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Default_StrokeThickness_MyRect
    • When_ExtendedSelectionWithoutItemClick_Then_PointersEvents_UITests_Windows_UI_Xaml_Controls_ListView_ListView_Selection_Pointers
    • When_SingleSelectionWithItemClick_Then_PointersEvents_UITests_Windows_UI_Xaml_Controls_ListView_ListView_Selection_Pointers
    • Default_StrokeThickness_MyPolygon
    • Default_StrokeThickness_MyPolyline
    • Default_StrokeThickness_MyLine
    • Default_StrokeThickness_MyEllipse
    • ListView_SelectedItems_SamplesApp_Windows_UI_Xaml_Controls_ListView_ListViewSelectedItems
    • When_SingleSelectionWithoutItemClick_Then_PointersEvents_UITests_Windows_UI_Xaml_Controls_ListView_ListView_Selection_Pointers
    • TestProgressRing_InitialState_UITests_Microsoft_UI_Xaml_Controls_ProgressRing_WinUIProgressRing_Features
    • Default_StrokeThickness_MyPath
    • SequentialAnimations_SamplesApp_Windows_UI_Xaml_Media_Animation_SequentialAnimationsPage
    • When_Theme_Changed_No_Crash_UITests_Windows_UI_Xaml_Controls_CalendarView_CalendarView_Theming
    • When_TransformToVisual_ScrollViewer_UITests_Shared_Windows_UI_Xaml_UIElementTests_TransformToVisual_ScrollViewer
  • wasm-automated-net10.0-WinUI-RuntimeTests-0: 0 changed over 1

  • wasm-automated-net10.0-WinUI-RuntimeTests-1: 0 changed over 1

  • wasm-automated-net10.0-WinUI-RuntimeTests-2: 0 changed over 1

@ajpinedam ajpinedam left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change looks good.

The analyzer is complaining about non-nullable objects though:

Error: /home/runner/work/uno/uno/src/Uno.UI.RuntimeTests/Tests/Windows_Storage/Given_StorageFile_Native.base.cs(297,30): error CS8600: Converting null literal or possible null value to non-nullable type. [/home/runner/work/uno/uno/src/Uno.UI.RuntimeTests/Uno.UI.RuntimeTests.Skia.csproj::TargetFramework=net10.0]
Error: /home/runner/work/uno/uno/src/Uno.UI.RuntimeTests/Tests/Windows_Storage/Given_StorageFile_Native.base.cs(319,30): error CS8600: Converting null literal or possible null value to non-nullable type. [/home/runner/work/uno/uno/src/Uno.UI.RuntimeTests/Uno.UI.RuntimeTests.Skia.csproj::TargetFramework=net10.0]

@MartinZikmund
MartinZikmund force-pushed the dev/mazi/storagefile-stream branch from e9f6c24 to 65f8cf1 Compare May 6, 2026 08:31
Copilot AI review requested due to automatic review settings May 6, 2026 08:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

@MartinZikmund

Copy link
Copy Markdown
Member Author

@ajpinedam Thanks for the catch — fixed in 5d6ba7a by annotating createdFile as StorageFile? in both When_OpenStreamForReadAsync_Stream_Is_ReadOnly and When_OpenStreamForWriteAsync_Stream_CanWrite, matching the pattern used by every other test in the file (the file has #nullable enable at the top).

Copilot AI review requested due to automatic review settings May 6, 2026 09:19
@MartinZikmund

MartinZikmund commented May 6, 2026 •

Copy link
Copy Markdown
Member Author

Review comments addressed — 7c1ba8e662

All 6 open threads are handled in a single commit: 7c1ba8e662 — test: Scope OpenStreamAsync FileMode regression tests to filesystem providers.

Validation level: code inspection only. Nothing was built, run, or tested locally — Azure Pipelines will verify.

The core issue the reviewers spotted (and why they're right)

The fix in this PR only touches the two File.Open-based implementations:

Provider OpenStreamAsync Path
StorageFile.Local File.Open(Path, ToFileMode(...)) ← fixed here real filesystem path
StorageFile.iOS (security-scoped) File.Open(Path, ToFileMode(...)) ← fixed here real filesystem path
WASM native (OPFS) inherits base → OpenAsync(...).AsStream() — never calls ToFileMode synthetic (Path.Combine(parent.Path, name))
Android SAF inherits base → OpenAsync(...).AsStream() — never calls ToFileMode SAF document URI path

So the two regression tests were asserting File.Open-semantics against providers that don't have them, using System.IO against paths that aren't real. They'd have failed spuriously on WASM native, and on Android SAF the OpenStreamForWriteAsync re-create simply doesn't happen (the SAF ContentResolver stream would throw instead).

Fix: a protected virtual bool HasFileSystemBackedPath => false; on the base class, overridden to true only by the Local and iOS security-scoped test classes. The two regression tests Assert.Inconclusive(...) on the other providers — matching the existing Assert.Inconclusive pattern already used in Given_StorageFile_Native.wasm.cs, and reported as TestResult.Inconclusive (not a failure) by UnitTestsControl.

Fixed (6)

File:line Reviewer point What changed
Given_StorageFile_Native.base.cs:364 (copilot) File.Delete/File.Exists on createdFile.Path isn't valid for providers with a synthetic path Tests now opt in via HasFileSystemBackedPath; only Local + iOS security-scoped run them, everything else is Inconclusive
Given_StorageFile_Native.base.cs:374 (copilot) File.Exists assertion won't reflect existence for non-filesystem providers Same opt-in gate — the assertion now only runs where Path is a real filesystem path
Given_StorageFile_Native.base.cs:362 (github-actions) System.IO in a base class shared with virtual-FS providers; prefer [PlatformCondition] over #if for attributes Both points taken: #if WINAPPSDK [Ignore] → [PlatformCondition(ConditionMode.Exclude, RuntimeTestPlatforms.NativeWinUI)], plus the per-provider gate. See note below on why I did not use RuntimeTestPlatforms.Wasm
Given_StorageFile_Native.base.cs:349 (github-actions) Missing [GitHubWorkItem] for #21311 Added to When_OpenStreamForWriteAsync_FileDoesNotExist_Stream_CreatesFile
Given_StorageFile_Native.base.cs:387 (github-actions) Missing [GitHubWorkItem] for #21311 Added to When_OpenStreamForReadAsync_FileDoesNotExist_Throws
StorageFile.cs:227 (github-actions) 7-line XML doc for a 3-line self-evident method Trimmed to a 2-line <summary> keeping only the non-obvious bit (ReadWrite creates, Read requires existence)

One deliberate deviation from the suggested fix

The ultrareview bot offered [PlatformCondition(ConditionMode.Exclude, RuntimeTestPlatforms.NativeWinUI | RuntimeTestPlatforms.Wasm)]. I used the platform condition for NativeWinUI but not the Wasm flag, because PlatformCondition is per-runtime-platform, not per-provider, and both Given_StorageFile_Native (OPFS) and Given_StorageFile_Native_Local (real emscripten FS) derive from this base and run on WASM:

  • Excluding Wasm would also have killed the Local-provider coverage on WASM, which does exercise the fix.
  • It would still have left Android SAF broken, which the suggestion didn't account for.

The HasFileSystemBackedPath gate scopes precisely to the providers the fix applies to, which is what the Copilot threads asked for ("limiting these tests to providers where Path maps to a local filesystem path (Local + iOS security-scoped)").

Needs @MartinZikmund input (0)

Nothing — no thread was left open.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

auto-merge was automatically disabled May 6, 2026 09:29

Head branch was pushed to by a user without write access

Copilot AI commented May 6, 2026

Copy link
Copy Markdown
Contributor

Change looks good.

The analyzer is complaining about non-nullable objects though:...

The CS8600 nullable warnings on lines 297 and 319 were already fixed (both createdFile declarations are now StorageFile?). The remaining build failure was a separate issue: Assert.ThrowsExceptionAsync (MSTest) doesn't exist in this project — fixed in 062a7a4 by replacing it with Assert.ThrowsAsync, which is the pattern used elsewhere in Uno.UI.RuntimeTests.

@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 211139 found UI Test snapshots differences: skia-linux-screenshots: 0, skia-windows-screenshots: 70, wasm: 0

Details
  • skia-linux-screenshots: 0 changed over 2338

  • skia-windows-screenshots: 70 changed over 2340

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • Gamepad_CurrentReading.png-dark
    • Gamepad_CurrentReading.png
    • Gamepad_Enumeration.png-dark
    • Gamepad_Enumeration.png
    • DisplayInformation.png-dark
    • DisplayInformation.png
    • Focus_FocusVisual_Properties.png-dark
    • FluentStyle_NavigationViewSample.png-dark
    • FluentStyle_NavigationViewSample.png
    • Examples.png
    • Buttons.png-dark
    • DropDownButtonPage.png-dark
    • DropDownButtonPage.png
    • DoubleImageBrushInList.png-dark
    • DoubleImageBrushInList.png
    • ElementLevelTheme.png-dark
  • wasm: 0 changed over 1073

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 211139 has failed on Uno.UI - CI.

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or it will be closed in 10 days.

@github-actions github-actions Bot added the stale This item has been marked as stale and will be closed if there is no activity. label Jul 6, 2026
Copilot AI and others added 7 commits July 13, 2026 10:31
Add When_OpenStreamForWriteAsync_FileDoesNotExist_Stream_CreatesFile
(positive case: ReadWrite → FileMode.OpenOrCreate creates the file) and
When_OpenStreamForReadAsync_FileDoesNotExist_Throws (negative case: Read
→ FileMode.Open still throws FileNotFoundException). Skipped on
WINAPPSDK since native WinUI's StorageFile isn't subject to this fix.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@MartinZikmund
MartinZikmund force-pushed the dev/mazi/storagefile-stream branch from 062a7a4 to 823db2e Compare July 13, 2026 08:45
@github-actions

github-actions Bot commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 4m 14s —— View job


Review complete

  • Load MCP tools
  • Read changed files
  • Analyze the implementation
  • Post inline review comments
  • Update summary

Overall verdict: fix-first (minor)

The core fix is correct. FileRandomAccessStream.local.cs independently already used FileMode.OpenOrCreate (so OpenAsync was never broken), but OpenStreamAsync in both StorageFile.Local and StorageFile.SecurityScopedFile hard-coded FileMode.Open — this PR patches both correctly. The ToFileMode helper is clean, consistent with ToFileAccess and ToFileShare, and the switch is exhaustive.

Issues (3 inline comments)

Severity File Summary
Medium Given_StorageFile_Native.base.cs:362 System.IO.File.Delete/File.Exists called from a base class that is also inherited by the WASM provider; OPFS-backed paths are virtual and the System.IO calls may not correspond to the provider's actual store. Replace #if WINAPPSDK [Ignore] with [PlatformCondition(ConditionMode.Exclude, RuntimeTestPlatforms.NativeWinUI | RuntimeTestPlatforms.Wasm)] to exclude both WinUI and WASM targets.
Low Given_StorageFile_Native.base.cs:349,387 Both regression tests are missing [GitHubWorkItem("https://github.com/unopplatform/uno/issues/21311")] — required by .claude/rules/runtime-tests.md for traceability.
Low StorageFile.cs:219–227 The 7-line XML doc on ToFileMode violates the code-style rule ("a line or two, never a wall of text"); a single <summary> line is sufficient.

What's correct

  • ToFileMode mapping: Read → FileMode.Open, ReadWrite → FileMode.OpenOrCreate — matches WinUI semantics.
  • OpenAsync path (via FileRandomAccessStream.CreateLocal) was already using FileMode.OpenOrCreate — no regression gap there.
  • When_OpenStreamForReadAsync_Stream_Is_ReadOnly and When_OpenStreamForWriteAsync_Stream_CanWrite are solid general access-mode coverage tests.
  • When_OpenStreamForReadAsync_FileDoesNotExist_Throws correctly asserts the fix didn't accidentally make Read auto-create files.

Comment thread src/Uno.UWP/Storage/StorageFile.cs Resolved
@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 221946 found UI Test snapshots differences: skia-linux-screenshots: 8, skia-windows-screenshots: 2348, wasm: 0

Details
  • skia-linux-screenshots: 8 changed over 2348

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ButtonClippingTestsControl.png-dark
    • ButtonClippingTestsControl.png
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • ContentControl_DefaultText.png-dark
    • ClipboardTests.png-dark
    • Buttons.png-dark
    • Buttons.png
  • skia-windows-screenshots: 2348 changed over 2390

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AppBarToggleButtonTest.png-dark
    • AppWindowClosing.png-dark
    • AppXamlDefinedResources.png
    • AutoBorderStretchwithtopmargin.png
    • AutoSuggestBox_BitmapIcon.png-dark
    • AutoSuggestBox_SoftKeboard.png
    • Basics_Automated.png
    • BenchmarkDotNet.png-dark
    • BitmapIcon_Monochromatic.png-dark
    • BitmapIcon_Monochromatic.png
    • BorderRightwithmargins.png
    • BorderTopwithmargins.png-dark
    • Border_CornerRadius_Binding.png
    • Border_CornerRadius_BorderThickness.png-dark
    • Border_Simple_No_Background_With_TextBox.png
    • Border_Simple_with_non_Uniform_Thickness.png-dark
    • BreadcrumbBarPage.png-dark
    • BreadcrumbBarPage.png
    • Button_IsEnabled_Automated.png-dark
    • Button_IsEnabled_Automated.png
  • wasm: 0 changed over 1076

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 221946 has failed on Uno.UI - CI.

@github-actions github-actions Bot removed the stale This item has been marked as stale and will be closed if there is no activity. label Jul 14, 2026
…roviders

The two #21311 regression tests manipulate the backing file through System.IO,
which is only valid where StorageFile.Path is a real filesystem path (Local and
iOS security-scoped). Browser OPFS and Android SAF expose a synthetic path and
never route through ToFileMode, so they now opt out via HasFileSystemBackedPath.

Also swaps the #if WINAPPSDK [Ignore] for [PlatformCondition] and adds the
[GitHubWorkItem] annotations.
@github-actions

github-actions Bot commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @MartinZikmund's task in 3m 22s —— View job


Review complete

  • Load MCP tools
  • Read changed files
  • Analyze the implementation
  • Post inline review comments
  • Update summary

Overall verdict: ship (minor)

The fix is correct and complete. ToFileMode maps Read → FileMode.Open and ReadWrite → FileMode.OpenOrCreate, matching WinUI semantics. Both StorageFile.Local and StorageFile.SecurityScopedFile (iOS) are updated consistently. All previously-flagged issues from prior reviews have been addressed:

  • [GitHubWorkItem("…/issues/21311")] annotations are present on both regression tests ✅
  • [PlatformCondition(ConditionMode.Exclude, RuntimeTestPlatforms.NativeWinUI)] correctly scopes the tests ✅
  • StorageFile? nullable annotations on createdFile ✅
  • Assert.ThrowsAsync (not the non-existent ThrowsExceptionAsync) ✅

1 inline comment (Low)

File Line Note
StorageFile.cs 219–222 XML <summary> is still 4 lines; prior review suggested collapsing to one line — suggestion posted

Cross-cutting notes (no specific line)

  • HasFileSystemBackedPath + Assert.Inconclusive: the guard is pragmatic — [PlatformCondition] can't distinguish SAF-backed Android from filesystem-backed Skia-on-Android within the same base class. WASM is already soft-skipped by GetRootFootAsync's own Inconclusive call when OPFS is unavailable. The design is sound even if Assert.Inconclusive is normally flagged by the runtime-tests rule.

  • OpenAsync path: FileRandomAccessStream.CreateLocal already uses FileMode.OpenOrCreate, so the IRandomAccessStream path was never broken. This PR correctly targets only the OpenStreamAsync (raw System.IO.Stream) path.

Comment thread src/Uno.UWP/Storage/StorageFile.cs Resolved
@unodevops

Copy link
Copy Markdown
Contributor

@nventive-devops

Copy link
Copy Markdown
Contributor

The build 222260 found UI Test snapshots differences: skia-linux-screenshots: 57, skia-windows-screenshots: 2348, wasm: 11

Details
  • skia-linux-screenshots: 57 changed over 2348

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ButtonClippingTestsControl.png
    • Buttons.png-dark
    • ClipboardTests.png-dark
    • DisplayInformation.png-dark
    • ImageIconPage.png-dark
    • ButtonClippingTestsControl.png-dark
    • CalendarView_Theming.png-dark
    • CalendarView_Theming.png
    • DropDownButtonPage.png-dark
    • DropDownButtonPage.png
    • Focus_FocusVisual_Properties.png-dark
    • Buttons.png
    • ElementLevelTheme.png-dark
    • ElementLevelTheme.png
    • Gamepad_CurrentReading.png-dark
    • Gamepad_CurrentReading.png
    • Gamepad_Enumeration.png-dark
    • Gamepad_Enumeration.png
    • Image_AnimatedWebP.png-dark
    • Image_AnimatedWebP.png
  • skia-windows-screenshots: 2348 changed over 2390

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • AndroidWindowInsets.png-dark
    • AppBarButtonTest.png-dark
    • AppBarButtonTest.png
    • AppBarButtonWithIconTest.png
    • AndroidWindowInsets.png
    • AnimatedIconPage.png-dark
    • AnimatedIconPage.png
    • AppBarButtonWithIconTest.png-dark
    • AppBarToggleButtonTest.png-dark
    • AppBarToggleButtonTest.png
    • ApplicationViewMode.png-dark
    • AppXamlDefinedResources.png
    • ApplicationViewSpanningRectsPage.png
    • AppWindowClosing.png-dark
    • ArcSegment.png
    • ApplicationViewSizing.png
    • ApplicationViewSpanningRectsPage.png-dark
    • ApplicationViewSizing.png-dark
    • Attributed_text_FontSize_Changing.png-dark
    • Attributed_text_Supserscript.png-dark
  • wasm: 11 changed over 1076

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • UITests.Windows_UI_Xaml_Media_Animation.ColorAnimation_Background
    • UITests.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_NavigationProperties
    • UITests.Windows_UI_Xaml_Controls.CalendarView.CalendarView_Theming
    • UITests.Shared.Microsoft_UI_Xaml_Controls.ExpanderTests.WinUIExpanderPage
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Ogg_Extension
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Minimal
    • Uno.UI.Samples.Content.UITests.WebView.WebView_AnchorNavigation
    • UITests.Uno_Web.Http.CookieManagerTests
    • SamplesApp.Microsoft_UI_Xaml_Controls.WebView2Tests.WebView2_EnableDevTools
    • SamplesApp.Wasm.Windows_UI_Xaml_Controls.ListView.ListView_IsSelected
    • SamplesApp.Windows_UI_Xaml_Controls.ListView.ListViewSelectedItems

@MartinZikmund
MartinZikmund merged commit f3d64ea into master Jul 15, 2026
48 checks passed
@MartinZikmund
MartinZikmund deleted the dev/mazi/storagefile-stream branch July 15, 2026 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

platform/ios 🍎 Categorizes an issue or PR as relevant to the iOS platform ready-to-merge Automatically merge the PR once all '.mergify.yml' policies are met

Projects

None yet

Development

Successfully merging this pull request may close these issues.

StorageFile.Local.OpenStreamAsync always use File.Open instead of the FileAccessMode argument

7 participants