Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release/9.0-preview7] Add swiftcall signature check for mono_class_try_get_swift_error_class #105813

Merged

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Aug 1, 2024

Backport of #105408 to release/9.0-preview7

/cc @ivanpovazan @kotlarmilos

Customer Impact

  • Customer reported
  • Found internally

This is blocking the preview7 release for MAUI.
A sample MAUI iOS application crashes in Debug configuration when run on a physical device without this fix.
The code assumed that System.Runtime.InteropServices.Swift.SwiftError is always available in System.Private.CoreLib assembly which is not true as the type can be trimmed away if it is not referenced, which causes the crash.

Regression

  • Yes
  • No

This was introduced in: 4185f94

Testing

It was verified that by manually rooting System.Runtime.InteropServices.Swift.SwiftError the sample MAUI iOS application successfully runs.

Risk

Low.
This fix only affects Mono support for Apple targets and the loaded types are now properly null checked.
The Release app deployments are not affected and work as expected.

IMPORTANT: If this backport is for a servicing release, please verify that:

  • The PR target branch is release/X.0-staging, not release/X.0.

  • If the change touches code that ships in a NuGet package, you have added the necessary package authoring and gotten it explicitly reviewed.

@ivanpovazan
Copy link
Member

/cc: @dalexsoto @Redth

Copy link
Member

@jeffschwMSFT jeffschwMSFT left a comment

Choose a reason for hiding this comment

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

lgtm. adding @mmitche and @carlossanlop for timeline

@jeffschwMSFT jeffschwMSFT added the Servicing-consider Issue for next servicing release review label Aug 1, 2024
@jeffschwMSFT jeffschwMSFT added this to the 9.0.0 milestone Aug 1, 2024
Copy link
Member

@dalexsoto dalexsoto left a comment

Choose a reason for hiding this comment

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

Yes please, this is needed for out of the box MAUI apps to not crash on iOS devices

@carlossanlop
Copy link
Member

The Build wasi-wasm windows Release WasmBuildTests leg failed with a seemingly unrelated infra failure:

Microsoft.NET.Runtime.WebAssembly.Wasi.Sdk -> D:\a\_work\1\s\artifacts\packages\Release\Shipping\Microsoft.NET.Runtime.WebAssembly.Wasi.Sdk.9.0.0-ci.nupkg
  Microsoft.NET.Sdk.WebAssembly.Pack -> D:\a\_work\1\s\artifacts\packages\Release\Shipping\Microsoft.NET.Sdk.WebAssembly.Pack.9.0.0-ci.nupkg
  
  
      Directory: D:\a\_work\1\s\src\mono\wasi
  
  
  Mode                 LastWriteTime         Length Name                                                                 
  ----                 -------------         ------ ----                                                                 
  d-----          8/1/2024   3:42 PM                wasi-sdk                                                             
  bin/wasm32-wasip1-threads-clang.exe: truncated gzip input
  tar.exe: Error exit delayed from previous errors.
D:\a\_work\1\s\src\mono\mono.proj(337,5): error MSB3073: The command "powershell -NonInteractive -command "& D:\a\_work\1\s\src\mono\wasi\\provision.ps1 -WasiSdkUrl https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-22/wasi-sdk-22.0.m-mingw64.tar.gz -WasiSdkVersion 22 -WasiSdkPath D:/a/_work/1/s/src/mono/wasi/wasi-sdk/ -WasiLocalPath D:\a\_work\1\s\src\mono\wasi\; Exit $LastExitCode "" exited with code 1.
##[error]src\mono\mono.proj(337,5): error MSB3073: (NETCORE_ENGINEERING_TELEMETRY=Build) The command "powershell -NonInteractive -command "& D:\a\_work\1\s\src\mono\wasi\\provision.ps1 -WasiSdkUrl https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-22/wasi-sdk-22.0.m-mingw64.tar.gz -WasiSdkVersion 22 -WasiSdkPath D:/a/_work/1/s/src/mono/wasi/wasi-sdk/ -WasiLocalPath D:\a\_work\1\s\src\mono\wasi\; Exit $LastExitCode "" exited with code 1.

Build FAILED.

@jeffschwMSFT jeffschwMSFT added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels Aug 1, 2024
@lewing
Copy link
Member

lewing commented Aug 1, 2024

The Build wasi-wasm windows Release WasmBuildTests leg failed with a seemingly unrelated infra failure:

Microsoft.NET.Runtime.WebAssembly.Wasi.Sdk -> D:\a\_work\1\s\artifacts\packages\Release\Shipping\Microsoft.NET.Runtime.WebAssembly.Wasi.Sdk.9.0.0-ci.nupkg
  Microsoft.NET.Sdk.WebAssembly.Pack -> D:\a\_work\1\s\artifacts\packages\Release\Shipping\Microsoft.NET.Sdk.WebAssembly.Pack.9.0.0-ci.nupkg
  
  
      Directory: D:\a\_work\1\s\src\mono\wasi
  
  
  Mode                 LastWriteTime         Length Name                                                                 
  ----                 -------------         ------ ----                                                                 
  d-----          8/1/2024   3:42 PM                wasi-sdk                                                             
  bin/wasm32-wasip1-threads-clang.exe: truncated gzip input
  tar.exe: Error exit delayed from previous errors.
D:\a\_work\1\s\src\mono\mono.proj(337,5): error MSB3073: The command "powershell -NonInteractive -command "& D:\a\_work\1\s\src\mono\wasi\\provision.ps1 -WasiSdkUrl https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-22/wasi-sdk-22.0.m-mingw64.tar.gz -WasiSdkVersion 22 -WasiSdkPath D:/a/_work/1/s/src/mono/wasi/wasi-sdk/ -WasiLocalPath D:\a\_work\1\s\src\mono\wasi\; Exit $LastExitCode "" exited with code 1.
##[error]src\mono\mono.proj(337,5): error MSB3073: (NETCORE_ENGINEERING_TELEMETRY=Build) The command "powershell -NonInteractive -command "& D:\a\_work\1\s\src\mono\wasi\\provision.ps1 -WasiSdkUrl https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-22/wasi-sdk-22.0.m-mingw64.tar.gz -WasiSdkVersion 22 -WasiSdkPath D:/a/_work/1/s/src/mono/wasi/wasi-sdk/ -WasiLocalPath D:\a\_work\1\s\src\mono\wasi\; Exit $LastExitCode "" exited with code 1.

Build FAILED.

this is tracked with a known issue #105290

@carlossanlop
Copy link
Member

carlossanlop commented Aug 1, 2024

The next failure is a timeout in Build browser-wasm linux Release LibraryTests_Threading that affected System.IO and System.Text.Json tests:

[16:42:41] info: [PASS] System.IO.Tests.Directory_EnumFiles_str_str_so.SearchPatternWithDoubleDots_Core
[17:55:56] fail: Tests timed out. Killing driver service pid 79
[17:55:56] fail: Application has finished with exit code TIMED_OUT but 0 was expected
XHarness exit code: 71 (GENERAL_FAILURE)
[17:11:40] info: [PASS] System.Text.Json.Serialization.Tests.NumberHandlingTestsDynamic.Unquoted_FloatingPointConstants_Read_Fail
[17:11:52] fail: Tests timed out. Killing driver service pid 80
[17:11:52] fail: Application has finished with exit code TIMED_OUT but 0 was expected
XHarness exit code: 71 (GENERAL_FAILURE)

Apparently we have so many tests in those two areas that we're spending too much time running them. Maybe the timeout limit could be increased for those two?

Anyway, seems unrelated to this change.

@carlossanlop
Copy link
Member

carlossanlop commented Aug 1, 2024

I suspect the two remaining legs are also struggling to execute those same tests and might timeout as well.

  • runtime (Build browser-wasm windows Release LibraryTests)
  • runtime (Build browser-wasm windows Release WasmBuildTests)

@carlossanlop
Copy link
Member

A couple of failed legs got automatically re-run and now they passed.

There's only one remaining which seems to be stuck. Since we're short on time, and all other wasm and wasi legs already passed, I will fast-merge.

@richaplinvs
Copy link

Is there more we can do help diagnose this as a consumer? I found nothing in the application output and nothing in the Apple crash logs. i.e. Is there something we can enable on top of debug to get more verbose output.

@ivanpovazan
Copy link
Member

Is there more we can do help diagnose this as a consumer? I found nothing in the application output and nothing in the Apple crash logs. i.e. Is there something we can enable on top of debug to get more verbose output.

I am looking into how to improve diagnostics around such crashes, will provide an update once I have one. Thank you for understanding.

@ivanpovazan
Copy link
Member

@richaplinvs we found the issue and I opened #106064 to track it.

@github-actions github-actions bot locked and limited conversation to collaborators Sep 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-VM-meta-mono Servicing-approved Approved for servicing release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants