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

LanguageExt incompatible to iOS #64

Closed
maxbartunik opened this issue Jul 5, 2021 · 6 comments
Closed

LanguageExt incompatible to iOS #64

maxbartunik opened this issue Jul 5, 2021 · 6 comments

Comments

@maxbartunik
Copy link

Using Telega in a Xamarin.iOS project produces following exception when calling TelegramClient.Connect():

Telega internal exception. Unhandled exception. See an inner exception.
at Telega.TaskWrapper.Wrap[T] (System.Func`1[TResult] wrapper)
at Telega.Connect.TgBellhop.Connect (Microsoft.Extensions.Logging.ILogger logger, Telega.Connect.ConnectInfo connectInfo, Telega.CallMiddleware.TgCallMiddlewareChain callMiddlewareChain, Telega.Connect.TcpClientConnectionHandler connHandler)
at Telega.Client.TelegramClient.Connect (Telega.Connect.ConnectInfo connectInfo, Telega.ISessionStore store, Telega.CallMiddleware.TgCallMiddlewareChain callMiddlewareChain, Telega.Connect.TcpClientConnectionHandler tcpClientConnectionHandler, Microsoft.Extensions.Logging.ILogger logger)
at Telega.Client.TelegramClient.Connect (System.Int32 apiId, Telega.ISessionStore store, System.Net.IPEndPoint endpoint, Telega.CallMiddleware.TgCallMiddlewareChain callMiddlewareChain, Telega.Connect.TcpClientConnectionHandler tcpClientConnectionHandler)

Inner exception:
{System.PlatformNotSupportedException} The type initializer for 'LanguageExt.Range3' threw an exception. at LanguageExt.Prelude.Range (System.Int32 from, System.Int32 count, System.Int32 step) at Telega.Rpc.TgSystemMessageHandler.ReadContainer (System.IO.BinaryReader br) at Telega.Rpc.TgSystemMessageHandler+<>c__DisplayClass15_0.<Handle>b__0 (Telega.Rpc.TgSystemMessageHandler+Message message) at (wrapper delegate-invoke) System.Func2[Telega.Rpc.TgSystemMessageHandler+Message,LanguageExt.Unit].invoke_TResult_T(Telega.Rpc.TgSystemMessageHandler/Message)
at LanguageExt.CondExt.Apply[A,B] (A a, System.Func2[T,TResult] f) at Telega.Rpc.TgTransport.ReceiveLoopImpl (Microsoft.Extensions.Logging.ILogger logger) at Telega.Rpc.TgTransport.ReceiveLoop (Microsoft.Extensions.Logging.ILogger logger) at Telega.Rpc.TgTransport+<>c__DisplayClass19_01[T].g__CheckReceiveLoop|0 ()
at Telega.Rpc.TgTransport+<>c__DisplayClass19_11[T].<Call>g__AwaitResult|1 () at Telega.CallMiddleware.FloodMiddleware+<>c__DisplayClass1_11[T].g__ReceiveWrapper|1 ()
at Telega.CallMiddleware.TgCustomizedTransport.Call[T] (Telega.Rpc.Dto.ITgFunc1[TRes] func) at Telega.Connect.TgConnectionEstablisher.EstablishConnection (Microsoft.Extensions.Logging.ILogger logger, Telega.Connect.ConnectInfo connectInfo, Telega.CallMiddleware.TgCallMiddlewareChain callMiddlewareChain, Telega.Connect.TcpClientConnectionHandler connHandler) at Telega.TaskWrapper.Wrap[T] (System.Func1[TResult] wrapper)

This is due to the use of System.Reflection.Emit in LanguageExt (which is not supported on iOS: https://docs.microsoft.com/en-us/xamarin/ios/internals/limitations).

@maxbartunik
Copy link
Author

I have become a fan of Telega and would be very happy for a solution...

@maxbartunik maxbartunik changed the title incompatible to iOS LanguageExt incompatible to iOS Jul 5, 2021
@maxbartunik
Copy link
Author

Issue opened in LanguageExt: louthy/language-ext#887

@ilyalatt
Copy link
Owner

ilyalatt commented Jul 5, 2021

Hello. The easy way is to use fixed LanguageExt version. However Telega moves away from LanguageExt because it adds too much complexity for basic things. See this comment and the roadmap. You can try simplified version 0.5.0-preview001 without LanguageExt.

@maxbartunik
Copy link
Author

The above error occured in 0.5.0-preview001. However, I could not track down the link to LanguageExt in this repo. Perhaps a faulty nuget package? LanguageExt is listed as a dependency in the 0.5.0-preview001 package...

@maxbartunik
Copy link
Author

Using LanguageExt v3.5.30-beta resolves the issue.

@ilyalatt
Copy link
Owner

ilyalatt commented Jul 5, 2021

Looks like a staled package. I've pushed 0.5.0-preview002 with the latest master.

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

2 participants