nblockchain / TgSharp

Telegram client library implemented in C#
32 stars 12 forks source link

NullRefrenceException in BigInteger.cs in CompareTo method after forking the library and update it to layer 121 #40

Closed Muaath5 closed 3 years ago

Muaath5 commented 3 years ago

Hi,

I Forked TgSharp project to run it in .NET Core and update it to layer 121

My new library link: TgSharp.NETCore

Error position

Stack trace File: I Run it and I am getting error in BigInteger.cs file. Line in BigInteger.cs: In line 344 in constructor (ctor) when calling Pow method. Method: Inside method CompareTo method.

Error: NullRefrenceException

Stack trace is in photo above

NOTE: Pow method is using Equals method that uses CompareTo method.

Source code

CompareTo method source:

public int CompareTo(BigInteger value)
{
    return sign < value.sign ? -1
        : sign > value.sign ? 1
        : sign == 0 ? 0
        : sign * CompareNoLeadingZeroes(0, magnitude, 0, value.magnitude);
}

Line 344, in constructor (ctor):

b = b.Multiply(r.Pow(s.Length)); // HERE is an error

I am thinking the error is in sign variable, But how can I fix it?

aarani commented 3 years ago

You have to give more context (like what changes you made to the authentication part of the code which is the only place we use BigInteger.cs for) also your fork breaks compatibility with our repo which makes it even harder to compare it. What I can tell you with 100% confidence is that I have upgraded this library to layer 121 and targeted .NET standard and It didn't break on me.

Muaath5 commented 3 years ago

You have to give more context (like what changes you made to the authentication part of the code which is the only place we use BigInteger.cs for) also your fork breaks compatibility with our repo which makes it even harder to compare it. What I can tell you with 100% confidence is that I have upgraded this library to layer 121 and targeted .NET standard and It didn't break on me.

You can see my new library link in GitHub.

https://github.com/Muaath5/TgSharp.NETCore