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

Bring osu.Android to .NET 6 #17462

Closed
wants to merge 64 commits into from
Closed

Conversation

huoyaoyuan
Copy link
Contributor

@huoyaoyuan huoyaoyuan commented Mar 26, 2022

Development requirement

Run dotnet workload install android to install the necessary SDK components (may require sudo).
Can be changed to dotnet workload restore once there's no old projects (Xamarin) remaining.
The default Android SDK version changed from 29 to 31.
Xamarin toolchain in Visual Studio should be still required. I haven't tested if the managed components can be compiled without Xamarin installed.

Known issue

Realm currently only works in Release configuration. A hard crash will happen in Debug configuration.

Compatibility check list

Audio, network and video all work fine together with framework side change.

Moq compatibility not tested.

Fastlane deployment not tested.

@huoyaoyuan
Copy link
Contributor Author

The XA4301 warning is about picking linux assets for android from NativeLibs, since android is considered a child of linux. Should be resolved at framework side.

@huoyaoyuan
Copy link
Contributor Author

The mono debugger issue can be workarounded by removing Xamarn.Essentials and reimplement it. There's no blocking issue I can find now.

@huoyaoyuan huoyaoyuan marked this pull request as ready for review April 3, 2022 14:58
@pull-request-size pull-request-size bot added size/XL and removed size/L labels Apr 6, 2022
osu.Android/OsuGameAndroid.cs Outdated Show resolved Hide resolved
osu.Android/OsuGameActivity.cs Outdated Show resolved Hide resolved
@bdach
Copy link
Collaborator

bdach commented Apr 10, 2022

Briefly tested this branch on my two devices, and got a pretty worrying exception stack trace on one of them:

2022-04-10 19:01:17 [error]: An unobserved error has occurred.
2022-04-10 19:01:17 [error]: System.AggregateException: TaskExceptionHolder_UnhandledException (net_http_ssl_connection_failed)
2022-04-10 19:01:17 [error]: ---> System.Net.Http.HttpRequestException: net_http_ssl_connection_failed
2022-04-10 19:01:17 [error]: ---> System.Security.Authentication.AuthenticationException: net_auth_SSPI
2022-04-10 19:01:17 [error]: ---> Interop+AndroidCrypto+SslException: Exception_WasThrown, Interop+AndroidCrypto+SslException
2022-04-10 19:01:17 [error]: Exception_EndOfInnerExceptionStack
2022-04-10 19:01:17 [error]: at System.Net.Security.SslStream.<ForceAuthenticationAsync>d__173`1[[System.Net.Security.AsyncReadWriteAdapter, System.Net.Security, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]].MoveNext()
2022-04-10 19:01:17 [error]: at System.Net.Http.ConnectHelper.EstablishSslConnectionAsync(SslClientAuthenticationOptions , HttpRequestMessage , Boolean , Stream , CancellationToken )
2022-04-10 19:01:17 [error]: Exception_EndOfInnerExceptionStack
2022-04-10 19:01:17 [error]: at System.Net.Http.ConnectHelper.EstablishSslConnectionAsync(SslClientAuthenticationOptions , HttpRequestMessage , Boolean , Stream , CancellationToken )
2022-04-10 19:01:17 [error]: at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage , Boolean , CancellationToken )
2022-04-10 19:01:17 [error]: at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage , Boolean , CancellationToken )
2022-04-10 19:01:17 [error]: at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(HttpRequestMessage )
2022-04-10 19:01:17 [error]: at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.<WaitWithCancellationAsync>d__1[[System.Net.Http.HttpConnection, System.Net.Http, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a]].MoveNext()
2022-04-10 19:01:17 [error]: at System.Net.Http.HttpConnectionPool.GetHttp11ConnectionAsync(HttpRequestMessage , Boolean , CancellationToken )
2022-04-10 19:01:17 [error]: at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage , Boolean , Boolean , CancellationToken )
2022-04-10 19:01:17 [error]: at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage , Boolean , CancellationToken )
2022-04-10 19:01:17 [error]: at System.Net.Http.DecompressionHandler.SendAsync(HttpRequestMessage , Boolean , CancellationToken )
2022-04-10 19:01:17 [error]: at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage , HttpCompletionOption , CancellationTokenSource , Boolean , CancellationTokenSource , CancellationToken )
2022-04-10 19:01:17 [error]: at osu.Framework.IO.Network.WebRequest.Complete(Exception e)
2022-04-10 19:01:17 [error]: at osu.Framework.IO.Network.WebRequest.internalPerform(CancellationToken cancellationToken)
2022-04-10 19:01:17 [error]: at osu.Framework.IO.Network.WebRequest.PerformAsync(CancellationToken cancellationToken)
2022-04-10 19:01:17 [error]: at osu.Framework.Extensions.ExceptionExtensions.ExceptionExtensions.Rethrow(Exception exception)
2022-04-10 19:01:17 [error]: at osu.Framework.Extensions.ExceptionExtensions.ExceptionExtensions.RethrowAsSingular(AggregateException aggregateException)
2022-04-10 19:01:17 [error]: at osu.Framework.IO.Network.WebRequest.Perform()
2022-04-10 19:01:17 [error]: at osu.Game.Online.API.APIRequest.Perform(IAPIProvider api)
2022-04-10 19:01:17 [error]: at osu.Game.Online.API.APIAccess.Perform(APIRequest request)
2022-04-10 19:01:17 [error]: Exception_EndOfInnerExceptionStack

As you could guess, the above causes everything online to not work. I've checked and this does not happen on the latest release.

Device in question is a Samsung device, API 24. #17499 possibly related?

@huoyaoyuan
Copy link
Contributor Author

huoyaoyuan commented Apr 11, 2022

Did you test if it reproduces on that device with old xamarin? If so, I think it could not block this PR as it's not a new issue.

You may change NET6_0 to use HttpClientHandler here to see if there's difference.

global.json Outdated
@@ -0,0 +1,6 @@
{
"sdk": {
Copy link
Member

Choose a reason for hiding this comment

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

Not sure we want this? @smoogipoo

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Theoretically, there are environments that can compile net6.0 but have unfixed issues in the SDK.
If we introduce net7.0 in any project, I think it can serve as a soft requirement for SDK version.

Copy link
Member

Choose a reason for hiding this comment

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

@smoogipoo can you make a call on this one? from our brief discussion last week i think you'd want to see this removed?

Copy link
Contributor

@smoogipoo smoogipoo Dec 19, 2022

Choose a reason for hiding this comment

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

I think I would prefer this being removed, since it's one of those things that silently changes compilation in the background that isn't easily noticeable via any tooling. That being said, it is not a strong preference.

<AndroidSupportedAbis>armeabi-v7a;x86;arm64-v8a</AndroidSupportedAbis>
<EnableLLVM>false</EnableLLVM> <!-- This currently causes random lockups during gameplay. https://github.com/mono/mono/issues/18973 -->

<!-- This currently causes random lockups during gameplay. https://github.com/mono/mono/issues/18973 -->
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if this is still relevant

Copy link
Member

@frenzibyte frenzibyte Dec 17, 2022

Choose a reason for hiding this comment

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

Testing with the same reproduction steps in the issue thread, I can't reproduce this at all with LLVM enabled (assuming it's enabled by default given that clang is used during building).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it's probably not, but we can test this in a separated PR.

Copy link
Member

Choose a reason for hiding this comment

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

As long as it isn't forgotten.

Copy link
Member

@frenzibyte frenzibyte left a comment

Choose a reason for hiding this comment

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

Other than what's mentioned above, this looks pretty sane to me and matches iOS (minus the workarounds).

@peppy
Copy link
Member

peppy commented Dec 19, 2022

Have removed for now. Have also tested this branch deploying to device and all seems good. I'll cherry-pick the changes across to the framework update branch in their current state.

peppy added a commit to peppy/osu that referenced this pull request Dec 19, 2022
@peppy peppy mentioned this pull request Dec 19, 2022
@huoyaoyuan huoyaoyuan deleted the net6.0-android branch December 19, 2022 14:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants