dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.25k stars 4.73k forks source link

[Mono][Android][Test] Unhandled Exception: System.PlatformNotSupportedException: Operation is not supported on this platform. #54905

Open fanyang-mono opened 3 years ago

fanyang-mono commented 3 years ago

Failed tests list:

Full log

      06-21 22:19:56.080  3815  3832 I DOTNET  : MonoRunner initialize,, entryPointLibName=NativeLibraryTests.dll
      06-21 22:19:56.080  3815  3832 D DOTNET  : file_path: /data/user/0/net.dot.Interop_NativeLibrary/files/runtimeconfig.bin
      06-21 22:19:56.082  3815  3832 D DOTNET  : assembly_preload_hook: System.Private.CoreLib (null) /data/user/0/net.dot.Interop_NativeLibrary/files
      06-21 22:19:56.101  3815  3832 D DOTNET  : assembly_preload_hook: NativeLibraryTests.dll (null) /data/user/0/net.dot.Interop_NativeLibrary/files
      06-21 22:19:56.101  3815  3832 D DOTNET  : Executable: NativeLibraryTests.dll
      06-21 22:19:56.101  3815  3832 D DOTNET  : assembly_preload_hook: System.Runtime  /data/user/0/net.dot.Interop_NativeLibrary/files
      06-21 22:19:56.101  3815  3832 D DOTNET  : assembly_preload_hook: System.Runtime.InteropServices  /data/user/0/net.dot.Interop_NativeLibrary/files
      06-21 22:19:56.101  3815  3832 D DOTNET  : assembly_preload_hook: TestLibrary  /data/user/0/net.dot.Interop_NativeLibrary/files
      06-21 22:19:56.102  3815  3832 D DOTNET  : assembly_preload_hook: System.Console  /data/user/0/net.dot.Interop_NativeLibrary/files
      06-21 22:19:56.179  3815  3832 E mono    : 
      06-21 22:19:56.179  3815  3832 E mono    : Unhandled Exception:
      06-21 22:19:56.179  3815  3832 E mono    : System.PlatformNotSupportedException: Operation is not supported on this platform.
      06-21 22:19:56.179  3815  3832 E mono    :    at NativeLibraryToLoad.GetFileName() in NativeLibraryTests.dll:token 0x600000d+0x27
      06-21 22:19:56.179  3815  3832 E mono    :    at NativeLibraryToLoad.GetFullPath() in NativeLibraryTests.dll:token 0x600000e+0x12
      06-21 22:19:56.179  3815  3832 E mono    :    at NativeLibraryTest.Main() in NativeLibraryTests.dll:token 0x6000001+0x14
      06-21 22:19:56.179  3815  3832 E DOTNET  : UnhandledException: System.PlatformNotSupportedException Operation is not supported on this platform.    at NativeLibraryToLoad.GetFileName() in NativeLibraryTests.dll:token 0x600000d+0x27
      06-21 22:19:56.179  3815  3832 E DOTNET  :    at NativeLibraryToLoad.GetFullPath() in NativeLibraryTests.dll:token 0x600000e+0x12
      06-21 22:19:56.179  3815  3832 E DOTNET  :    at NativeLibraryTest.Main() in NativeLibraryTests.dll:token 0x6000001+0x14
      06-21 22:19:56.215  1792  3093 I ActivityManager: Process net.dot.Interop_NativeLibrary (pid 3815) has died: fore FGS 
      06-21 22:19:56.215  1792  3093 W ActivityManager: Crash of app net.dot.Interop_NativeLibrary running instrumentation ComponentInfo{net.dot.Interop_NativeLibrary/net.dot.MonoRunner}
      06-21 22:19:56.215  1792  3093 I ActivityManager: Force stopping net.dot.Interop_NativeLibrary appid=10158 user=0: finished inst
      06-21 22:19:56.217  1535  1535 I Zygote  : Process 3815 exited cleanly (1)
      06-21 22:19:56.217  1792  3835 W Binder  : Outgoing transactions from this process must be FLAG_ONEWAY
      06-21 22:19:56.217  1792  3835 W Binder  : java.lang.Throwable
      06-21 22:19:56.217  1792  3835 W Binder  :    at android.os.BinderProxy.transact(BinderProxy.java:480)
      06-21 22:19:56.217  1792  3835 W Binder  :    at android.app.IInstrumentationWatcher$Stub$Proxy.instrumentationFinished(IInstrumentationWatcher.java:205)
      06-21 22:19:56.217  1792  3835 W Binder  :    at com.android.server.am.InstrumentationReporter$MyThread.run(InstrumentationReporter.java:86)
      06-21 22:19:56.218  3804  3804 D AndroidRuntime: Shutting down VM
      06-21 22:19:56.260  1792  1819 I libprocessgroup: Successfully killed process cgroup uid 10158 pid 3815 in 44ms
ghost commented 3 years ago

Tagging subscribers to 'arch-android': @steveisok, @akoeplinger See info in area-owners.md if you want to be subscribed.

Issue Details
Failed test list: - Interop/NativeLibrary/API/NativeLibraryTests/NativeLibraryTests.sh - Interop/NativeLibrary/Callback/CallbackStressTest_TargetUnix/CallbackStressTest_TargetUnix.sh ``` 06-21 22:19:56.080 3815 3832 I DOTNET : MonoRunner initialize,, entryPointLibName=NativeLibraryTests.dll 06-21 22:19:56.080 3815 3832 D DOTNET : file_path: /data/user/0/net.dot.Interop_NativeLibrary/files/runtimeconfig.bin 06-21 22:19:56.082 3815 3832 D DOTNET : assembly_preload_hook: System.Private.CoreLib (null) /data/user/0/net.dot.Interop_NativeLibrary/files 06-21 22:19:56.101 3815 3832 D DOTNET : assembly_preload_hook: NativeLibraryTests.dll (null) /data/user/0/net.dot.Interop_NativeLibrary/files 06-21 22:19:56.101 3815 3832 D DOTNET : Executable: NativeLibraryTests.dll 06-21 22:19:56.101 3815 3832 D DOTNET : assembly_preload_hook: System.Runtime /data/user/0/net.dot.Interop_NativeLibrary/files 06-21 22:19:56.101 3815 3832 D DOTNET : assembly_preload_hook: System.Runtime.InteropServices /data/user/0/net.dot.Interop_NativeLibrary/files 06-21 22:19:56.101 3815 3832 D DOTNET : assembly_preload_hook: TestLibrary /data/user/0/net.dot.Interop_NativeLibrary/files 06-21 22:19:56.102 3815 3832 D DOTNET : assembly_preload_hook: System.Console /data/user/0/net.dot.Interop_NativeLibrary/files 06-21 22:19:56.179 3815 3832 E mono : 06-21 22:19:56.179 3815 3832 E mono : Unhandled Exception: 06-21 22:19:56.179 3815 3832 E mono : System.PlatformNotSupportedException: Operation is not supported on this platform. 06-21 22:19:56.179 3815 3832 E mono : at NativeLibraryToLoad.GetFileName() in NativeLibraryTests.dll:token 0x600000d+0x27 06-21 22:19:56.179 3815 3832 E mono : at NativeLibraryToLoad.GetFullPath() in NativeLibraryTests.dll:token 0x600000e+0x12 06-21 22:19:56.179 3815 3832 E mono : at NativeLibraryTest.Main() in NativeLibraryTests.dll:token 0x6000001+0x14 06-21 22:19:56.179 3815 3832 E DOTNET : UnhandledException: System.PlatformNotSupportedException Operation is not supported on this platform. at NativeLibraryToLoad.GetFileName() in NativeLibraryTests.dll:token 0x600000d+0x27 06-21 22:19:56.179 3815 3832 E DOTNET : at NativeLibraryToLoad.GetFullPath() in NativeLibraryTests.dll:token 0x600000e+0x12 06-21 22:19:56.179 3815 3832 E DOTNET : at NativeLibraryTest.Main() in NativeLibraryTests.dll:token 0x6000001+0x14 06-21 22:19:56.215 1792 3093 I ActivityManager: Process net.dot.Interop_NativeLibrary (pid 3815) has died: fore FGS 06-21 22:19:56.215 1792 3093 W ActivityManager: Crash of app net.dot.Interop_NativeLibrary running instrumentation ComponentInfo{net.dot.Interop_NativeLibrary/net.dot.MonoRunner} 06-21 22:19:56.215 1792 3093 I ActivityManager: Force stopping net.dot.Interop_NativeLibrary appid=10158 user=0: finished inst 06-21 22:19:56.217 1535 1535 I Zygote : Process 3815 exited cleanly (1) 06-21 22:19:56.217 1792 3835 W Binder : Outgoing transactions from this process must be FLAG_ONEWAY 06-21 22:19:56.217 1792 3835 W Binder : java.lang.Throwable 06-21 22:19:56.217 1792 3835 W Binder : at android.os.BinderProxy.transact(BinderProxy.java:480) 06-21 22:19:56.217 1792 3835 W Binder : at android.app.IInstrumentationWatcher$Stub$Proxy.instrumentationFinished(IInstrumentationWatcher.java:205) 06-21 22:19:56.217 1792 3835 W Binder : at com.android.server.am.InstrumentationReporter$MyThread.run(InstrumentationReporter.java:86) 06-21 22:19:56.218 3804 3804 D AndroidRuntime: Shutting down VM 06-21 22:19:56.260 1792 1819 I libprocessgroup: Successfully killed process cgroup uid 10158 pid 3815 in 44ms ```
Author: fanyang-mono
Assignees: -
Labels: `area-Interop-mono`, `os-android`
Milestone: 6.0.0
steveisok commented 3 years ago

@fanyang-mono I believe there needs to be an additional OS check added https://github.com/dotnet/runtime/blob/57bfe474518ab5b7cfe6bf7424a79ce3af9d6657/src/tests/Interop/NativeLibrary/NativeLibraryToLoad/NativeLibraryToLoad.cs#L14-L26

fanyang-mono commented 3 years ago

Tests didn't pass after adding an Android switch to NativeLibraryToLoad.cs. There are more work to be done, in order to make the tests pass.

  1. Make runtime tests native build work for Android https://github.com/dotnet/runtime/blob/main/src/tests/build.sh#L265-L266
  2. Include the generated native libraries (.so files) in the Android app. For Xamarin.Android, build action AndroidNativeLibrary needs to be used. https://github.com/xamarin/xamarin-android/blob/681887ebdbd192ce7ce1cd02221d4939599ba762/tests/CodeGen-Binding/Xamarin.Android.JcwGen-Tests/Xamarin.Android.JcwGen-Tests.csproj#L82-L87
steveisok commented 2 years ago

@fanyang-mono Is this still an issue?

fanyang-mono commented 2 years ago

Moving to 8.0.0

fanyang-mono commented 1 year ago

Moving to 9.0.0