Skip to content

MAUI iOS App Store rejection: App references non-public symbols _FSEventStreamCreate #57931

Closed

Description

@josephatkuvio

Description

I'm running into an App Store rejection issue with .NET 6.0 Preview 7 + MAUI + iOS + WebView.Maui:

The app references non-public symbols in XXX.XXX: _FSEventStreamCreate, _FSEventStreamInvalidate, _FSEventStreamRelease, _FSEventStreamScheduleWithRunLoop, _FSEventStreamStart, _FSEventStreamStop, _FSEventStreamUnscheduleFromRunLoop

I believe that the offending package is System.IO.FileSystem.Watcher, which I'm guessing is referenced (and so ILLink won't remove, no matter what) because of this line: https://github.com/dotnet/aspnetcore/blob/fd9dfeccc1ab407a818d286128697b48149c384a/src/Components/WebView/WebView/src/StaticWebAssetsLoader.cs#L166.

Repro: Build the base MAUI Blazor template in Release+iOS+ARM64 and publish to App Store TestFlight, using the following in csproj:

<RuntimeIdentifier Condition="$(TargetFramework.Contains('-ios')) AND '$(Configuration)' == 'Release'">ios-arm64</RuntimeIdentifier>

Configuration

.NET 6 Preview 7
MAUI Single Project
Blazor + MAUI.WebView
iOS ARM64 Build

Regression?

Exact issue occurred w/ mtouch in 2019: mono/mono#14290

Other information

Tried many combinations of the following properties. MtouchLink=Full successfully removes System.IO.FileSystem.Watcher, but only because it also removes the default constructors for BlazorWebView. The following combo got me the closest to a resolution, but no dice, my best guess being because WebView.Maui.IOSWebViewManager inherits from WebView.WebViewManager, which instantiates PhysicalFileProvider during its static assets load.

<TrimMode>link</TrimMode>
<MtouchLink>SdkOnly</MtouchLink>
<_ExtraTrimmerArgs>-x linker.xml --action link "Microsoft.AspNetCore.Components.WebView" --action link "Microsoft.AspNetCore.Components.WebView.MauiSparc"</_ExtraTrimmerArgs>

linker.xml:

<linker>
	<assembly fullname="Microsoft.AspNetCore.Components.WebView.Maui">
		<type fullname="Microsoft.AspNetCore.Components.WebView.Maui.BlazorWebViewHandler">
		    <method signature="System.Void .ctor()" />
		</type>
	</assembly>
</linker>

Activity

  1. ghost added
    untriagedNew issue has not been triaged by the area owner
    on Aug 23, 2021
  2. Redth commented on Aug 24, 2021

    @Redth
    Member
  3. akoeplinger commented on Aug 24, 2021

    @akoeplinger
    Member

    This happens because we're using FSEventStream APIs which are only supported on macOS/Catalyst: https://developer.apple.com/documentation/coreservices/1443980-fseventstreamcreate

    // Create the event stream for the path and tell the stream to watch for file system events.
    SafeEventStreamHandle eventStream = Interop.EventStream.FSEventStreamCreate(

  4. Redth commented on Aug 24, 2021

    @Redth
    Member

    @akoeplinger what's the action here?

  5. akoeplinger commented on Aug 24, 2021

    @akoeplinger
    Member

    In mono/mono we "solved" this by using a FileSystemWatcher implementation which throws PlatformNotSupportedException. We can easily do the same here but not sure if that will solve the MAUI Blazor issue with PhysicalFileProvider.

  6. Redth commented on Aug 24, 2021

    @Redth
    Member

    @Eilon might need your input here too

  7. josephatkuvio commented on Aug 24, 2021

    @josephatkuvio
    Author

    I was able to resolve it for my personal case by removing the hardcoded reference to PhysicalFileProvider and replacing it with the IFileProvider from the parent class, and rebuilding aspnetcore. This was enough to get the linker to remove System.IO.FileSystem.Watcher. This doesn't solve the underlying issue of course, but may be a viable strategy to get MAUI projects app-store-releaseable.

  8. added this to the 6.0.0 milestone on Aug 24, 2021
  9. removed
    untriagedNew issue has not been triaged by the area owner
    on Aug 24, 2021
  10. self-assigned this
    on Aug 24, 2021
  11. Eilon commented on Aug 25, 2021

    @Eilon
    Contributor

    Interesting. If we simply disable usage of the file watcher in .NET MAUI Blazor Desktop apps, would that be enough? We should probably do that anyway because there's no need to watch for changes in a native app (it's useful in ASP.NET Core apps, though).

    If we disable file watching entirely in Blazor Desktop, would it pass scrutiny in App Store testing? Or is even the existence of a potential code path that could call it enough to warrant rejection?

  12. 7 remaining items

  13. Eilon commented on Aug 26, 2021

    @Eilon
    Contributor

    Here's the PR for ASP.NET Core to remove the reference to PhysicalFileProvider, which is where the file system watcher stuff is called (though not actually used in these scenarios): dotnet/aspnetcore#35750

  14. adamsitnik commented on Aug 26, 2021

    @adamsitnik
    Member

    @akoeplinger #58142 got merged, can we close the issue now or some work still remains?

  15. akoeplinger commented on Aug 26, 2021

    @akoeplinger
    Member

    I want to backport it to 6.0, just need to clarify whether it should be rc1 or rc2

  16. ghost added
    in-prThere is an active PR which will close this issue when it is merged
    on Aug 26, 2021
  17. ghost removed
    in-prThere is an active PR which will close this issue when it is merged
    on Aug 26, 2021
  18. akoeplinger commented on Aug 26, 2021

    @akoeplinger
    Member

    Backported to 6.0-rc1.

    Thanks again for the report @josephatkuvio !

  19. Eilon commented on Aug 26, 2021

    @Eilon
    Contributor

    @akoeplinger so with this change, it's safe for all iOS to use PhysicalFileProvider, because now on iOS there won't even be a reference to the File Watcher at all? As in, nothing in the set of assemblies that might conceivably be deployed in the app package (IPK) would contain apparent usage of File Watcher? (Obviously someone could manually write such code, but I'm talking only about using these "standard" types.)

  20. akoeplinger commented on Aug 26, 2021

    @akoeplinger
    Member

    That's correct, the System.IO.FileSystem.Watcher.dll is basically empty on iOS and every method will just throw PlatformNotSupportedException now.

    That means there's no reference to the disallowed native APIs anymore.

  21. ghost locked as resolved and limited conversation to collaborators on Sep 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions