sebheron / TikTokLiveSharp

Port of TikTok live library for C#
59 stars 50 forks source link

Still NullReferenceException #4

Closed Skytrymotion closed 2 years ago

Skytrymotion commented 2 years ago

Hey, I'm sorry to bother you, but I'm too inexperienced to do it myself.

Now the test Project is working, but if I try to use it in .NET Framework 4.8 I get the old NullReferenceException Error. I need this Framework, because of a mod I'm making.

sebheron commented 2 years ago

Any chance you could either link the project and/or the stack trace?

Skytrymotion commented 2 years ago

Here: https://drive.google.com/file/d/1IwiHUsCC8vgVBkDVMG_Fjo-mWYEnS9V8/view?usp=sharing

Thanks for the help

Skytrymotion commented 2 years ago

I would love to help with the development, cause I'm very interested, but I need some more knowledge. Can you provide me a basic list of things I should research for this project, so I can assist and send pull requests?

sebheron commented 2 years ago

So I don't have any way of testing your application as I don't have GTA. I've managed to get it working in a .NET Framework 4.7 console application and I can imagine it's not too difficult to make this work. I would try giving this a go first. Then in the case of your mod, I'd try adding references to the DLL for all of the requirements directly (protobuf.NET version 2.0.0.668 and Newtonsoft.Json version 13.0.1) and from there try to test it in a sandboxed environment. Also make sure the user is online while testing, is there a way to pass in the uniqueID from GTA directly? This might be a better solution in the long run.

Skytrymotion commented 2 years ago

I'll try it today, step by step. I was using a .NET framework 4.8 class library. And I'll try to add the references, but I don't think thats the issue, because GTA would throw a Missing Dependency error. I'm working on a Solution to write the uniqueID Ingame. But for now I can change the uniqueID in 3 button taps without restarting the game.

Skytrymotion commented 2 years ago

Tried everything, cant get it to work :(

Skytrymotion commented 2 years ago

I tried a workaround where I start the .exe from GTA, then use the Console output to control the game. It just crashes...

sebheron commented 2 years ago

If you're still working on this, I'd recommend cloning the repository and adding reference to the project directly, then possibly by placing break points you can figure out what exactly is causing the error. If you can get the stack trace too, that would really help.

Edit: I've pushed a separate branch for (supposed) .NET framework support. Can you try building and implementing this version?

Skytrymotion commented 2 years ago

So, even though I got no .NET or Debugging experience, I got something. At Line 89 in TiktTokBaseClient.cs the Task Start Aborts with "System.Threading.ThreadAbortException" in mscorlib.dll. Thread gets Aborted with Error Code (0x0).

So I have to learn how to investigate further, but if you can help me somehow I would appreciate it.

Btw. Sorry for my bad England

sebheron commented 2 years ago

Your English is great, don't worry at all.

If the thread is being aborted that likely means that Thread.Abort/Interupt is being called at some point. I'm not sure (off the top of my head) if it's being called by the library. If it is - try removing it, if not then you'll need to get the inner exception for the stack trace (have a Google on how to get it).