TLSharp icon indicating copy to clipboard operation
TLSharp copied to clipboard

TLSharp.Core.Network.PhoneMigrationException

Open nRafinia opened this issue 9 years ago • 6 comments

Hi, In MakeAuthAsync throw exception

($exception).InnerException {"Phone number registered to a different DC: 4. See: https://github.com/sochix/TLSharp#i-get-a-xxxmigrationexception-or-a-migrate_x-error"} System.Exception {TLSharp.Core.Network.PhoneMigrationException}

($exception).Message "One or more errors occurred." string

($exception).StackTrace " at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)\r\n at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)\r\n at System.Threading.Tasks.Task.Wait()\r\n at ConsoleApplication1.Program.Main(String[] args) in C:\Users\Admin\Documents\Visual Studio 2015\Projects\ConsoleApplication1\ConsoleApplication1\Program.cs:line 82" string

nRafinia avatar Apr 20 '17 17:04 nRafinia

Did you copy the whole stacktrace? I cannot see what method of TLSharp you were calling

knocte avatar Apr 21 '17 01:04 knocte

Method i call that trow exception: MakeAuthAsync

TLSharp.Core.Network.MtProtoSender.HandleRpcResult(UInt64 messageId, Int32 sequence, BinaryReader messageReader, TLMethod request) TLSharp.Core.Network.MtProtoSender.processMessage(UInt64 messageId, Int32 sequence, BinaryReader messageReader, TLMethod request) TLSharp.Core.Network.MtProtoSender.d__9.MoveNext() System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() TLSharp.Core.TelegramClient.d__14.MoveNext()

nRafinia avatar Apr 21 '17 07:04 nRafinia

Thanks Naser. The bug is in this method: https://github.com/sochix/TLSharp/blob/master/TLSharp.Core/TelegramClient.cs#L157

That method should contain a while loop and a catch block like this other method: https://github.com/sochix/TLSharp/blob/master/TLSharp.Core/TelegramClient.cs#L129

Feel free to send us a Pull Request!

knocte avatar Apr 21 '17 08:04 knocte

is this bug solved or not ? I have the same issue and i'm stuck. :(

AmiNadimi avatar May 15 '17 17:05 AmiNadimi

@AmiNadim it's not solved, but I explained above exactly how to solve it, so anyone that has 2 minutes of their time can contribute the fix in a pull request. Do you have 2 minutes to do it?

knocte avatar May 16 '17 01:05 knocte

Fixed in https://github.com/sochix/TLSharp/commit/0d55940c123008013f454c8c5b090884747789ff by AmiNadim.

knocte avatar May 18 '17 13:05 knocte