frankvHoof93 / TikTokLiveSharp

Port of TikTok live library for C#
https://vanhoof.dev
Other
140 stars 28 forks source link

Getting ProtoException: Invalid wire-type; this usually means you have over-written a file without truncating or setting the length #19

Closed yogev2255 closed 1 year ago

yogev2255 commented 1 year ago

Hey, I am getting this error :

ProtoException: Invalid wire-type; this usually means you have over-written a file without truncating or setting the length; see https://stackoverflow.com/q/2152978/23354 ProtoBuf.ProtoReader.ReadUInt64 () (at C:/Code/pb-net_24/src/protobuf-net/ProtoReader.cs:830) (wrapper dynamic-method) TikTokLiveSharp.Models.Protobuf.Objects.User.proto_18(object,ProtoBuf.ProtoReader) ProtoBuf.Serializers.CompiledSerializer.ProtoBuf.Serializers.IProtoSerializer.Read (System.Object value, ProtoBuf.ProtoReader source) (at C:/Code/pb-net_24/src/protobuf-net/Serializers/CompiledSerializer.cs:64) ProtoBuf.Meta.RuntimeTypeModel.Deserialize (System.Int32 key, System.Object value, ProtoBuf.ProtoReader source) (at C:/Code/pb-net_24/src/protobuf-net/Meta/RuntimeTypeModel.cs:826) ProtoBuf.ProtoReader.ReadTypedObject (System.Object value, System.Int32 key, ProtoBuf.ProtoReader reader, System.Type type) (at C:/Code/pb-net_24/src/protobuf-net/ProtoReader.cs:582) ProtoBuf.ProtoReader.ReadObject (System.Object value, System.Int32 key, ProtoBuf.ProtoReader reader) (at C:/Code/pb-net_24/src/protobuf-net/ProtoReader.cs:570) (wrapper dynamic-method) TikTokLiveSharp.Models.Protobuf.Messages.LinkMicBattleTeam.proto_138(object,ProtoBuf.ProtoReader) ProtoBuf.Serializers.CompiledSerializer.ProtoBuf.Serializers.IProtoSerializer.Read (System.Object value, ProtoBuf.ProtoReader source) (at C:/Code/pb-net_24/src/protobuf-net/Serializers/CompiledSerializer.cs:64) ProtoBuf.Meta.RuntimeTypeModel.Deserialize (System.Int32 key, System.Object value, ProtoBuf.ProtoReader source) (at C:/Code/pb-net_24/src/protobuf-net/Meta/RuntimeTypeModel.cs:826) ProtoBuf.ProtoReader.ReadTypedObject (System.Object value, System.Int32 key, ProtoBuf.ProtoReader reader, System.Type type) (at C:/Code/pb-net_24/src/protobuf-net/ProtoReader.cs:582) ProtoBuf.ProtoReader.ReadObject (System.Object value, System.Int32 key, ProtoBuf.ProtoReader reader) (at C:/Code/pb-net_24/src/protobuf-net/ProtoReader.cs:570) (wrapper dynamic-method) TikTokLiveSharp.Models.Protobuf.Messages.WebcastLinkMicBattle.proto_130(object,ProtoBuf.ProtoReader) ProtoBuf.Serializers.CompiledSerializer.ProtoBuf.Serializers.IProtoSerializer.Read (System.Object value, ProtoBuf.ProtoReader source) (at C:/Code/pb-net_24/src/protobuf-net/Serializers/CompiledSerializer.cs:64) ProtoBuf.Meta.RuntimeTypeModel.Deserialize (System.Int32 key, System.Object value, ProtoBuf.ProtoReader source) (at C:/Code/pb-net_24/src/protobuf-net/Meta/RuntimeTypeModel.cs:826) ProtoBuf.Meta.TypeModel.DeserializeCore (ProtoBuf.ProtoReader reader, System.Type type, System.Object value, System.Boolean noAutoCreate) (at C:/Code/pb-net_24/src/protobuf-net/Meta/TypeModel.cs:718) ProtoBuf.Meta.TypeModel.Deserialize (System.IO.Stream source, System.Object value, System.Type type, ProtoBuf.SerializationContext context) (at C:/Code/pb-net_24/src/protobuf-net/Meta/TypeModel.cs:591) ProtoBuf.Meta.TypeModel.Deserialize (System.IO.Stream source, System.Object value, System.Type type) (at C:/Code/pb-net_24/src/protobuf-net/Meta/TypeModel.cs:570) ProtoBuf.Serializer.Deserialize[T] (System.IO.Stream source) (at C:/Code/pb-net_24/src/protobuf-net/Serializer.cs:68) TikTokLiveSharp.Client.TikTokLiveClient.Deserialize[T] (System.IO.MemoryStream stream) (at Library/PackageCache/dev.vanhoof.tiktokliveunity@38c80598c7/TikTokLiveSharp/Client/TikTokLiveClient.cs:949) Rethrow as WebcastMessageException: Error Deserializing Message UnityEngine.Debug:LogException(Exception, Object) TikTokLiveSharp.Client.TikTokLiveClient:Deserialize(MemoryStream) (at Library/PackageCache/dev.vanhoof.tiktokliveunity@38c80598c7/TikTokLiveSharp/Client/TikTokLiveClient.cs:965) TikTokLiveSharp.Client.TikTokLiveClient:HandleMessage(Message) (at Library/PackageCache/dev.vanhoof.tiktokliveunity@38c80598c7/TikTokLiveSharp/Client/TikTokLiveClient.cs:525) TikTokLiveSharp.Client.TikTokLiveClient:HandleWebcastMessages(WebcastResponse) (at Library/PackageCache/dev.vanhoof.tiktokliveunity@38c80598c7/TikTokLiveSharp/Client/TikTokLiveClient.cs:301) TikTokLiveSharp.Client.<WebSocketLoop>d__49:MoveNext() (at Library/PackageCache/dev.vanhoof.tiktokliveunity@38c80598c7/TikTokLiveSharp/Client/TikTokBaseClient.cs:586) System.Runtime.CompilerServices.AsyncTaskMethodBuilder:SetResult() TikTokLiveSharp.Client.<SendAcknowledgement>d__51:MoveNext() (at Library/PackageCache/dev.vanhoof.tiktokliveunity@38c80598c7/TikTokLiveSharp/Client/TikTokBaseClient.cs:643) System.Runtime.CompilerServices.AsyncTaskMethodBuilder:SetResult() TikTokLiveSharp.Client.Socket.<WriteMessage>d__7:MoveNext() (at Library/PackageCache/dev.vanhoof.tiktokliveunity@38c80598c7/TikTokLiveSharp/Client/Socket/TikTokWebSocket.cs:95) System.Runtime.CompilerServices.AsyncTaskMethodBuilder1:SetResult(Int32) Mono.Net.Security.d57:MoveNext() System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1:SetResult(AsyncProtocolResult) Mono.Net.Security.d23:MoveNext() System.Runtime.CompilerServices.AsyncTaskMethodBuilder:SetResult() Mono.Net.Security.d24:MoveNext() System.Runtime.CompilerServices.AsyncTaskMethodBuilder:SetResult() Mono.Net.Security.d67:MoveNext() System.Threading._ThreadPoolWaitCallback:PerformWaitCallback() `

I am only using the subscribe event and the OnDisconnected,OnLiveEnded ,OnConnected , OnException

frankvHoof93 commented 1 year ago

Please make sure you're using the latest version of the library (v.0.9.3) If this error comes up again, please post the Base64-message along with the exception.

yogev2255 commented 1 year ago

Please make sure you're using the latest version of the library (v.0.9.3) If this error comes up again, please post the Base64-message along with the exception.

Hey thank you, it's the newest version, is there a different way to update it? I used version 0.9 and then I updated via the package manager

frankvHoof93 commented 1 year ago

Apologies, V0.9.3 accidentally removed some of that logging. V0.9.4 has re-enabled it. If you come across another ProtoException, please post the Base64-message for it here. ProtoException means that the message could not be (correctly) parsed. This usually occurs if ByteDance has changed its messaging-schema, meaning a new round of reverse engineering it is required.

yogev2255 commented 1 year ago

Apologies, V0.9.3 accidentally removed some of that logging. V0.9.4 has re-enabled it. If you come across another ProtoException, please post the Base64-message for it here. ProtoException means that the message could not be (correctly) parsed. This usually occurs if ByteDance has changed its messaging-schema, meaning a new round of reverse engineering it is required.

Np, and thank you so much can you check the OnSubscribe event? because it's not working for me It won't invoke the event even if someone subscribed

frankvHoof93 commented 1 year ago

I can't currently check that command, as testing it would require me to spend money (which I don't intend to do). You can enable 'PrintMessageData' on the client (either directly in the client, or through the ClientSettings-object), the lib will print the base64 for ALL incoming messages. If the OnSubscribe isn't firing, my best guess is that ByteDance changed which message it uses. If you can post the message, I can update it. Also note that Follow and Subscribe are separate events. One is free (follow), whilst the other isn't (subscribe).

yogev2255 commented 1 year ago

sure I would love you to help me debug this, how can I enable the PrintMessageData? Is it a function or something like that?

frankvHoof93 commented 1 year ago

If you're directly using the TikTokLiveClient, then it's part of the constructor. If you're using TikTokLiveUnity (and the TikTokLiveManager) then it's a part of the ClientSettings-Object, and can be set via the Inspector: image

yogev2255 commented 1 year ago

Sure, thank you :) I will do that and I will let you know

frankvHoof93 commented 1 year ago

Closing this issue for inactivity