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

RuntimeDetour selftest failing on armv7, Android 4.X / 5.X #50

Open
ZaneYork opened this issue May 15, 2019 · 15 comments
Open

RuntimeDetour selftest failing on armv7, Android 4.X / 5.X #50

ZaneYork opened this issue May 15, 2019 · 15 comments

Comments

@ZaneYork
Copy link

Thanks for your great job.I integrated the project to my Stardew Valley Mod Loader, and received some crash report on Android 5.1.1 and earlier version.
Here is the error log:
DetourRuntimeILPlatform._SelftestGetStruct (System.IntPtr x, System.IntPtr y)
System.Exception: This method should've been detoured!
screenshot

@0x0ade
Copy link
Member

0x0ade commented May 17, 2019

Sorry for the late reply, I've been busy at work for the last few days. Can you please check the latest changes on the master branch, specifically 3eab0eb? I hope that commit fixes your issue.

@ZaneYork
Copy link
Author

Thanks for your work.But the bug still exists.Here is the error log reported by Galaxy On5 in Android 5.1.1
[20:07:33 INFO SMAPI] SMAPI 3.0 with Stardew Valley 1.3.36 on Unix 3.10.9.10688110
[20:07:33 INFO SMAPI] SMDroid 1.4.1 for Stardew Valley Android release 11
[20:07:33 INFO SMAPI] Mods go here: /storage/emulated/0/SMDroid/Mods
[20:07:33 TRACE SMAPI] Log started at 2019-05-18T12:07:33 UTC
[20:07:35 ERROR SMAPI] Critical app domain exception: System.Exception: This method should've been detoured!
at MonoMod.RuntimeDetour.Platforms.DetourRuntimeILPlatform._SelftestGetStruct (System.IntPtr x, System.IntPtr y) [0x00011] in <75c6cc9bd50743aabb6844965448efb8>:0
[20:07:35 ERROR SMAPI] Critical app domain exception: System.Exception: This method should've been detoured!
at MonoMod.RuntimeDetour.Platforms.DetourRuntimeILPlatform._SelftestGetStruct (System.IntPtr x, System.IntPtr y) [0x00011] in <75c6cc9bd50743aabb6844965448efb8>:0

@0x0ade
Copy link
Member

0x0ade commented May 18, 2019

Do you know if the issue exists on newer versions of Android as well? Or is it limited to Android 5.X?

@ZaneYork
Copy link
Author

It's limited in Android 5.1.1/5.1/4.4.4, I try it on virtual machine of 4.4/5.1 x86 arch, not affected, maybe armabi only

@ZaneYork
Copy link
Author

Most affected devices
Galaxy On5 20.0%
R8207 20.0%
V3 20.0%
Others 40.0%

Most affected OS
5.1.1 40.0%
4.4.4 20.0%
5.1 20.0%
Others 20.0%

Others not means Android 6 or newer version, these devices does not report the OS version

@0x0ade
Copy link
Member

0x0ade commented May 19, 2019

From what I can gather, all the affected devices use armv7 chipsets. Sadly, right now I've only got a phone with an armv8 chipset and Android 8.1 (LG G6, unofficial LineageOS 15.1), and all tests pass with dotnet 64-bit and 32-bit.

I'm thus unable to replicate and debug this in the foreseeable future, but I'll still try to find a possible to fix this.

@0x0ade 0x0ade changed the title Self Test Failed RuntimeDetour selftest failing on armv7, Android 4.X / 5.X May 19, 2019
@0x0ade
Copy link
Member

0x0ade commented Jun 27, 2019

Does this issue still occur with a freshly built copy of MonoMod? There have been a few updates to the selftest since the last comment on this issue.

@0x0ade
Copy link
Member

0x0ade commented Jul 10, 2019

Someone on the MonoMod Discord server just confirmed that RuntimeDetour is working for them on armv7.

@ZaneYork
Copy link
Author

ZaneYork commented Apr 20, 2020

I made a loader project and this error show up again even in Android 10:

Package: com.zane.stardewvalley2
Version Code: 145
Version Name: 1.4.5.145
Android: 10
Android Build: QKQ1.190825.002
Manufacturer: Xiaomi
Model: Redmi K20 Pro Premium Edition
CrashReporter Key: 6305d3cb-f5a9-4afd-bec1-907397597b2f
Start Date: 2020-04-20T14:25:54.956Z
Date: 2020-04-20T14:26:39.66Z

Xamarin Exception Stack:
System.Exception: This method should've been detoured!
  at MonoMod.RuntimeDetour.Platforms.DetourRuntimeILPlatform._SelftestGetRefPtr () [0x0000f] in <790e30a8b3384273b9924f6907f4007e>:0

The possible cause to produce this issue:
1.The SMAPI was using the C# 8 feature, but the Xamarin was on the 9 which needs VS2015(can not support C# 8), so I use the compiler package to deal with this:

    <PackageReference Include="Microsoft.Net.Compilers" Version="3.3.1">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
    </PackageReference>

2.The loader project works fine to using Xamarin 10, but I needs to tweak it to Xamarin 9, so I choose the Rider IDE with MSBuild 15.0 to finish the work.

3.The Aapt2 raised an error, I turn off the Aapt2
<AndroidUseAapt2>false</AndroidUseAapt2>
4.Then the compile and install works well, and the origin logic works fine if I turn off the MonoMod feature by config, when I turn it on, this error rasied every time I launch the game.

@0x0ade 0x0ade reopened this Apr 20, 2020
@ZaneYork
Copy link
Author

ZaneYork commented Apr 24, 2020

Someone on the MonoMod Discord server just confirmed that RuntimeDetour is working for them on armv7.

This bug is really weird, some of the device of Android 4 or Android 5 reports incompatible.I flashed my device to Android 5.1.1, the error doesn't appealed. And the emulator also works fine, I guess this error may be associate with CPU or kernal version.

Here is the latest report.And you can also get the Installer from my git repo

Most affected devices
Galaxy J1 Mini			17.0%
Galaxy Grand Prime		17.0%
Galaxy Tab A 7.0		6.4%
Others					59.6%
Most affected OS
5.1.1					66.0%
5.1						12.8%
4.4.4					10.6%
Others					10.6%

@ZaneYork
Copy link
Author

I flashed my device to Android 4.4.4, this bug can be reproduced steadily, this bug is probably related to the system kernel version.

@sitefortest
Copy link

This bug can be reproduced steadily in "vivo X7" and "vivo Xplay5A", with the same kernel version( 3.10.73);
image
image

@Pietrodjaowjao
Copy link

image
Not happening in my psychical devices but its also happening in bluestacks android 11, probably because its armv7

@Pietrodjaowjao
Copy link

@nike4613 Sorry for ping but was this fixed in reorganize branch?

@nike4613
Copy link
Contributor

Reorg doesn't use selftesting, so in that sense, yes. However, it also does not currently have any ARM support. My understanding is that the ARM support in legacy was a best-effort anyway, and subject to issues like this one. #90 is broadly the tracking issue for ARM in reorg, though its name reflects that the main target is Mac M1. Always open for contributions on that point though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants