-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Description
Description
I am unable to use ably package with a dependency on System.Threading.Channels (the error might also have origin from System.Threading.Tasks.Extensions/System.Runtime.CompilerServices.Unsafe assembly) , throws below runtime exception on MAUI android.
Throws a runtime error while trying to run on android =>
System.TypeLoadException: 'Could not load type of field 'IO.Ably.Realtime.Workflow.RealtimeWorkflow+d__36:<>u__2' (11) due to:
Could not resolve type with token 010000ba from typeref (expected class 'System.Runtime.CompilerServices.ValueTaskAwaiter1'
in assembly 'mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e')
assembly:mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e type:System.Runtime.CompilerServices.ValueTaskAwaiter1 member:(null)
It works on a regular net6.0 library, MAUI windows machine, and the latest Xamarin Forms.
I tried all options to disable assembly trimming as per
https://learn.microsoft.com/en-us/dotnet/core/deploying/trimming/trimming-options?pivots=dotnet-6-0
but the issue still persists and the app throws an error at runtime.
I strongly feel the issue is related to a missing type in mscorlib same as the one mentioned in dotnet/maui#5078 and dotnet/maui#5142
Steps to Reproduce
- Clone the project from https://github.com/sac-fork/MauiAppAblyDemo
- Build and run it on android emulater ( I used default Pixel 5 - API 33 (API 13 - API 33) )
- Tap on
Click mebutton, it will throw above error.
Link to public reproduction project repository
Version with bug
6.0 / 7.0
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
Android API 13 to 33
Did you find any workaround?
No workarounds were found.
Relevant log output
System.TypeLoadException: 'Could not load type of field 'IO.Ably.Realtime.Workflow.RealtimeWorkflow+d__36:<>u__2' (11) due to: Could not resolve type with token 010000ba from typeref (expected class 'System.Runtime.CompilerServices.ValueTaskAwaiter1' in assembly 'mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e') assembly:mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e type:System.Runtime.CompilerServices.ValueTaskAwaiter1 member:(null)