nwesterhausen / valheim-discordconnector

A plugin to connect a Valheim server to a discord webhook.
https://discord-connector.valheim.games.nwest.one/
MIT License
27 stars 13 forks source link

ArgumentOutOfRangeException #185

Closed nwesterhausen closed 1 year ago

nwesterhausen commented 1 year ago

When running DiscordConnector on the latest patch of Valheim (0.214.2), this error was reported:

[Error  : Unity Log] ArgumentOutOfRangeException: Start index cannot be less than 0 or greater than input length.
Parameter name: start
Stack trace:
System.Text.RegularExpressions.Regex.Run (System.Boolean quick, System.Int32 prevlen, System.String input, System.Int32 beginning, System.Int32 length, System.Int32 startat) (at <5a2009c85b134970925993880e2ecb2e>:0)
System.Text.RegularExpressions.Regex.IsMatch (System.String input, System.Int32 startat) (at <5a2009c85b134970925993880e2ecb2e>:0)
System.Text.RegularExpressions.Regex.IsMatch (System.String input) (at <5a2009c85b134970925993880e2ecb2e>:0)
DiscordConnector.Patches.ChatPatches+OnNewChatMessage.Prefix (UnityEngine.GameObject& go, System.Int64& senderID, UnityEngine.Vector3& pos, Talker+Type& type, System.String& user, System.String& text, System.String& senderNetworkUserId) (at <a5cf2cc8b5164fc3ba213139bfb8efa2>:0)
(wrapper dynamic-method) Chat.DMD<Chat::OnNewChatMessage>(Chat,UnityEngine.GameObject,long,UnityEngine.Vector3,Talker/Type,UserInfo,string,string)
(wrapper dynamic-method) Chat.DMD<Chat::RPC_ChatMessage>(Chat,long,UnityEngine.Vector3,int,UserInfo,string,string)
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <695d1cc93cca45069c528c15c9fdd749>:0)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.Delegate.DynamicInvokeImpl (System.Object[] args) (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.Delegate.DynamicInvoke (System.Object[] args) (at <695d1cc93cca45069c528c15c9fdd749>:0)
RoutedMethod`5[T,U,V,B,K].Invoke (System.Int64 rpc, ZPackage pkg) (at <afd4e3f8ab8b460f8ff25d476fbd573e>:0)
ZRoutedRpc.HandleRoutedRPC (ZRoutedRpc+RoutedRPCData data) (at <afd4e3f8ab8b460f8ff25d476fbd573e>:0)
ZRoutedRpc.InvokeRoutedRPC (System.Int64 targetPeerID, ZDOID targetZDO, System.String methodName, System.Object[] parameters) (at <afd4e3f8ab8b460f8ff25d476fbd573e>:0)
ZRoutedRpc.InvokeRoutedRPC (System.Int64 targetPeerID, System.String methodName, System.Object[] parameters) (at <afd4e3f8ab8b460f8ff25d476fbd573e>:0)
(wrapper dynamic-method) Chat.DMD<Chat::SendText>(Chat,Talker/Type,string)
Game.UpdateRespawn (System.Single dt) (at <afd4e3f8ab8b460f8ff25d476fbd573e>:0)
Game.FixedUpdate () (at <afd4e3f8ab8b460f8ff25d476fbd573e>:0)
nwesterhausen commented 1 year ago

Here is a full log from 0.214.2 with only DiscordConnector loaded. Events include player joining, shouting, pinging and then leaving.


[Debug  :Valheim Discord Connector] Plugin games.nwest.valheim.discordconnector is loaded!
[Info   :   BepInEx] Loading [Display BepInEx Info In-Game 2.0.0]
[Message:   BepInEx] Chainloader startup complete
03/14/2023 09:09:41: Starting to load scene:start
ERROR: Shader UI/Default shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
Couldn't create a Convex Mesh from source mesh "default" within the maximum polygons limit (256). The partial hull will be used. Consider simplifying your mesh.
Couldn't create a Convex Mesh from source mesh "default" within the maximum polygons limit (256). The partial hull will be used. Consider simplifying your mesh.
ERROR: Shader Legacy Shaders/VertexLit shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
WARNING: Shader Unsupported: 'Standard (Specular setup)' - All subshaders removed
WARNING: Shader Did you use #pragma only_renderers and omit this platform?
WARNING: Shader If subshaders removal was intentional, you may have forgotten turning Fallback off?
ERROR: Shader Standard (Specular setup) shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
WARNING: Shader Unsupported: 'Standard (Specular setup)' - All subshaders removed
WARNING: Shader Did you use #pragma only_renderers and omit this platform?
WARNING: Shader If subshaders removal was intentional, you may have forgotten turning Fallback off?
WARNING: Shader Unsupported: 'Standard' - All subshaders removed
WARNING: Shader Did you use #pragma only_renderers and omit this platform?
WARNING: Shader If subshaders removal was intentional, you may have forgotten turning Fallback off?
ERROR: Shader Standard shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
WARNING: Shader Unsupported: 'Standard' - All subshaders removed
WARNING: Shader Did you use #pragma only_renderers and omit this platform?
WARNING: Shader If subshaders removal was intentional, you may have forgotten turning Fallback off?
WARNING: Shader Unsupported: 'Autodesk Interactive' - All subshaders removed
WARNING: Shader Did you use #pragma only_renderers and omit this platform?
WARNING: Shader If subshaders removal was intentional, you may have forgotten turning Fallback off?
ERROR: Shader Autodesk Interactive shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
WARNING: Shader Unsupported: 'Autodesk Interactive' - All subshaders removed
WARNING: Shader Did you use #pragma only_renderers and omit this platform?
WARNING: Shader If subshaders removal was intentional, you may have forgotten turning Fallback off?
ERROR: Shader Legacy Shaders/Particles/Additive shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
ERROR: Shader Legacy Shaders/Particles/Alpha Blended shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
ERROR: Shader Legacy Shaders/Particles/Alpha Blended Premultiply shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
ERROR: Shader Unlit/Color shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
ERROR: Shader Lux Lit Particles/ Bumped shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
Shader 'Lux Lit Particles/ Tess Bumped': fallback shader 'Lux Lit Particles/ Bumped Smoke' not found
WARNING: Shader Unsupported: 'Lux Lit Particles/ Tess Bumped' - All subshaders removed
WARNING: Shader Did you use #pragma only_renderers and omit this platform?
WARNING: Shader If subshaders removal was intentional, you may have forgotten turning Fallback off?
ERROR: Shader Lux Lit Particles/ Tess Bumped shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
WARNING: Shader Unsupported: 'Lux Lit Particles/ Tess Bumped' - All subshaders removed
WARNING: Shader Did you use #pragma only_renderers and omit this platform?
WARNING: Shader If subshaders removal was intentional, you may have forgotten turning Fallback off?
ERROR: Shader TextMeshPro/Mobile/Distance Field shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
WARNING: Shader Unsupported: 'TextMeshPro/Distance Field' - All subshaders removed
WARNING: Shader Did you use #pragma only_renderers and omit this platform?
WARNING: Shader If subshaders removal was intentional, you may have forgotten turning Fallback off?
ERROR: Shader TextMeshPro/Distance Field shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
WARNING: Shader Unsupported: 'TextMeshPro/Distance Field' - All subshaders removed
WARNING: Shader Did you use #pragma only_renderers and omit this platform?
WARNING: Shader If subshaders removal was intentional, you may have forgotten turning Fallback off?
Unloading 6 Unused Serialized files (Serialized files now loaded: 0)
UnloadTime: 3.688500 ms
Only custom filters can be played. Please add a custom filter or an audioclip to the audiosource (Amb_MainMenu).
HDR Render Texture not supported, disabling HDR on reflection probe.
03/14/2023 09:09:42: Get create world Dedicated2
03/14/2023 09:09:42: Using environment steamid 892970
03/14/2023 09:09:42: Using steam APPID:892970
Setting breakpad minidump AppID = 892970
03/14/2023 09:09:43: Server ID 90071992547409920
03/14/2023 09:09:43: Authentication:k_ESteamNetworkingAvailability_Waiting
03/14/2023 09:09:43: Steam game server initialized
03/14/2023 09:09:43: Using default prefs
03/14/2023 09:09:43: Valheim version:0.214.2
03/14/2023 09:09:43: Worldgenerator version setup:2
ERROR: Shader TextMeshPro/Sprite shader is not supported on this GPU (none of subshaders/fallbacks are suitable)
03/14/2023 09:09:43: Render threading mode:SingleThreaded
03/14/2023 09:09:43: Missing audio clip in music respawn
03/14/2023 09:09:43: Builder started
03/14/2023 09:09:43: Loaded localization file #0 - 'localization' language: 'English'
03/14/2023 09:09:43: Loaded localization file #1 - 'localization_extra' language: 'English'
03/14/2023 09:09:43: Loaded localization file #0 - 'localization' language: 'English'
03/14/2023 09:09:43: Loaded localization file #1 - 'localization_extra' language: 'English'
03/14/2023 09:09:43: Sending PlayFab login request (attempt 1)
03/14/2023 09:09:43: Login postponed until ID has been set.
The shader Hidden/Dof/DepthOfFieldHdr (UnityEngine.Shader) on effect Main Camera (UnityStandardAssets.ImageEffects.DepthOfField) is not supported on this platform!
The image effect Main Camera (UnityStandardAssets.ImageEffects.DepthOfField) has been disabled as it's not supported on the current platform.
The shader Hidden/SunShaftsComposite (UnityEngine.Shader) on effect Main Camera (UnityStandardAssets.ImageEffects.SunShafts) is not supported on this platform!
The shader Hidden/SimpleClear (UnityEngine.Shader) on effect Main Camera (UnityStandardAssets.ImageEffects.SunShafts) is not supported on this platform!
The image effect Main Camera (UnityStandardAssets.ImageEffects.SunShafts) has been disabled as it's not supported on the current platform.
03/14/2023 09:09:43: Starting music menu
03/14/2023 09:09:43: UI Group status changed Menu = True

Unloading 17 unused Assets to reduce memory usage. Loaded Objects now: 139183.
Total: 76.699400 ms (FindLiveObjects: 4.911200 ms CreateObjectMapping: 10.213900 ms MarkObjects: 61.359100 ms  DeleteObjects: 0.214500 ms)

Unloading 6 Unused Serialized files (Serialized files now loaded: 0)
UnloadTime: 10.144800 ms
HDR Render Texture not supported, disabling HDR on reflection probe.
HDR Render Texture not supported, disabling HDR on reflection probe.
[Debug  :Valheim Discord Connector] Unable to get World Name from ZNet. Object reference not set to an instance of an object
03/14/2023 09:09:48: Exception while waiting for respons from http://checkip.dyndns.org/ -> System.Net.WebException: The operation has timed out.
  at System.Net.HttpWebRequest+<RunWithTimeout>d__237`1[T].MoveNext () [0x00123] in <5a2009c85b134970925993880e2ecb2e>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Net.HttpWebRequest.GetResponse () [0x00013] in <5a2009c85b134970925993880e2ecb2e>:0
  at Utils.DownloadString (System.String downloadUrl, System.Int32 timeoutMS) [0x0001a] in <feae82763eb949e4bae28d97d231a825>:0
03/14/2023 09:09:48: Specified argument was out of the range of valid values.
Parameter name: i
03/14/2023 09:09:49: Exception while waiting for respons from http://checkip.dyndns.org/ -> System.Net.WebException: The operation has timed out.
  at System.Net.HttpWebRequest+<RunWithTimeout>d__237`1[T].MoveNext () [0x00123] in <5a2009c85b134970925993880e2ecb2e>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Net.HttpWebRequest.GetResponse () [0x00013] in <5a2009c85b134970925993880e2ecb2e>:0
  at Utils.DownloadString (System.String downloadUrl, System.Int32 timeoutMS) [0x0001a] in <feae82763eb949e4bae28d97d231a825>:0
03/14/2023 09:09:49: Specified argument was out of the range of valid values.
Parameter name: i
[Debug  :Valheim Discord Connector] Trying webhook with payload: {"content":"Server is starting up."} (event: ServerLaunch)
[Debug  :Valheim Discord Connector] Webhook has 'ALL' enabled
[Debug  :Valheim Discord Connector] Sending ServerLaunch message to Primary Webhook
03/14/2023 09:09:49: Using default prefs
03/14/2023 09:09:49: isModded: True
03/14/2023 09:09:49: Zonesystem Awake 306
03/14/2023 09:09:49: DungeonDB Awake 306
03/14/2023 09:09:49: Registering lobby
03/14/2023 09:09:49: PlayFab custom ID set to "PlayFab_My server_2456_17a3364676136f4083438b7c593ca3c61c032e61"
03/14/2023 09:09:49: Sending PlayFab login request (attempt 2)
03/14/2023 09:09:49: Worldgenerator version setup:1
03/14/2023 09:09:51: Audioman already exist, destroying self
03/14/2023 09:09:51: PlayFab logged in as "PlayFab_My server_2456_17a3364676136f4083438b7c593ca3c61c032e61"
03/14/2023 09:09:51: PlayFab local entity ID is 447EF84482E88128
03/14/2023 09:09:51: New session server "My server" that has join code , now 0 player(s)
03/14/2023 09:09:51: Register PlayFab server "My server" with IP
03/14/2023 09:09:51: Server 'My server' begin PlayFab create and join network for server

Unloading 107 unused Assets to reduce memory usage. Loaded Objects now: 142575.
Total: 95.238600 ms (FindLiveObjects: 5.182800 ms CreateObjectMapping: 12.332600 ms MarkObjects: 76.552300 ms  DeleteObjects: 1.169800 ms)

03/14/2023 09:09:53: Exception while waiting for respons from https://wtfismyip.com/text -> System.Net.WebException: The operation has timed out.
  at System.Net.HttpWebRequest+<RunWithTimeout>d__237`1[T].MoveNext () [0x00123] in <5a2009c85b134970925993880e2ecb2e>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Net.HttpWebRequest.GetResponse () [0x00013] in <5a2009c85b134970925993880e2ecb2e>:0
  at Utils.DownloadString (System.String downloadUrl, System.Int32 timeoutMS) [0x0001a] in <feae82763eb949e4bae28d97d231a825>:0
03/14/2023 09:09:53: Specified argument was out of the range of valid values.
Parameter name: i
03/14/2023 09:09:55: Zonesystem Start 306
03/14/2023 09:09:55: Added 3 locations, 0 vegetations, 0 environments, 0 biome env-setups, 0 clutter  from locations_cp1
03/14/2023 09:09:55: Added 1 locations, 0 vegetations, 1 environments, 0 biome env-setups, 0 clutter  from locations_mountaincaves
03/14/2023 09:09:55: Added 27 locations, 25 vegetations, 5 environments, 1 biome env-setups, 3 clutter  from locations_mistlands
03/14/2023 09:09:55: DungeonDB Start 306
03/14/2023 09:09:56: ZRpc timeout set to 30s
03/14/2023 09:09:56: Load world: Dedicated2 (Dedicated2)
03/14/2023 09:09:56: Loading 15542 zdos , my id 454951826 data version:29
03/14/2023 09:09:56: Loaded 170 dead zdos
03/14/2023 09:09:56: Removed 0 OLD generated ZDOS
03/14/2023 09:09:56: Loaded 9949 locations
03/14/2023 09:09:56: Unloading unused assets
Unloading 10 Unused Serialized files (Serialized files now loaded: 0)
03/14/2023 09:09:58: Exception while waiting for respons from https://wtfismyip.com/text -> System.Net.WebException: The operation has timed out.
  at System.Net.HttpWebRequest+<RunWithTimeout>d__237`1[T].MoveNext () [0x00123] in <5a2009c85b134970925993880e2ecb2e>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Net.HttpWebRequest.GetResponse () [0x00013] in <5a2009c85b134970925993880e2ecb2e>:0
  at Utils.DownloadString (System.String downloadUrl, System.Int32 timeoutMS) [0x0001a] in <feae82763eb949e4bae28d97d231a825>:0
03/14/2023 09:09:58: Specified argument was out of the range of valid values.
Parameter name: i
03/14/2023 09:10:01: Exception while waiting for respons from https://wtfismyip.com/text -> System.Net.WebException: The operation has timed out.
  at System.Net.HttpWebRequest+<RunWithTimeout>d__237`1[T].MoveNext () [0x00123] in <5a2009c85b134970925993880e2ecb2e>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Net.HttpWebRequest.GetResponse () [0x00013] in <5a2009c85b134970925993880e2ecb2e>:0
  at Utils.DownloadString (System.String downloadUrl, System.Int32 timeoutMS) [0x0001a] in <feae82763eb949e4bae28d97d231a825>:0
03/14/2023 09:10:01: Specified argument was out of the range of valid values.
Parameter name: i
[Debug  :Valheim Discord Connector] Trying webhook with payload: {"content":"Server has started!"} (event: ServerStart)
[Debug  :Valheim Discord Connector] Webhook has 'ALL' enabled
[Debug  :Valheim Discord Connector] Sending ServerStart message to Primary Webhook
The shader Hidden/Dof/DepthOfFieldHdr (UnityEngine.Shader) on effect Main Camera (UnityStandardAssets.ImageEffects.DepthOfField) is not supported on this platform!
The image effect Main Camera (UnityStandardAssets.ImageEffects.DepthOfField) has been disabled as it's not supported on the current platform.
The shader Hidden/SunShaftsComposite (UnityEngine.Shader) on effect Main Camera (UnityStandardAssets.ImageEffects.SunShafts) is not supported on this platform!
The shader Hidden/SimpleClear (UnityEngine.Shader) on effect Main Camera (UnityStandardAssets.ImageEffects.SunShafts) is not supported on this platform!
The image effect Main Camera (UnityStandardAssets.ImageEffects.SunShafts) has been disabled as it's not supported on the current platform.
03/14/2023 09:10:01: Game server connected

Unloading 10 unused Assets to reduce memory usage. Loaded Objects now: 1661357.
Total: 468.039800 ms (FindLiveObjects: 91.673600 ms CreateObjectMapping: 47.571200 ms MarkObjects: 327.607600 ms  DeleteObjects: 1.186800 ms)

03/14/2023 09:10:03: Joined PlayFab Party network with ID "edfa69eb-fb54-46ce-aacb-0f259e33bb4f|AwBhV2Ly6ubhQORQh0GdWaBzXJcggk5vcnRoQ2VudHJhbFVzAAAAAAAAn3aiEpapxSC+Owo1h8qJ5NuEOmtS0oeJqq8h6q5ybZZrblFkbnMtaXI4MWU1LWEzZWMzZjBhLWYxOTQtNDljNC04ZTI3LTE3YzI0MTkzYjJhMi5ub3J0aGNlbnRyYWx1cy5jbG91ZGFwcC5henVyZS5jb20="
03/14/2023 09:10:04: Updating lobby with public IP 68.39.163.130:2456
03/14/2023 09:10:04: Created PlayFab lobby with ID "88c15b55-59e4-46da-b0bf-69ef79a907f6", ConnectionString "cv1:88c15b55-59e4-46da-b0bf-69ef79a907f6|451107|kv1|cv1:wL5PbPh6I+h0SBBAmTm5AouH248J5Az7CjrNq+p7fOI=" and owned by "447EF84482E88128"
03/14/2023 09:10:04: Session "My server" registered with join code 690711
03/14/2023 09:10:04: Retry join-code check 99
03/14/2023 09:10:04: Lobby 88c15b55-59e4-46da-b0bf-69ef79a907f6 for world 'My server' recreated
03/14/2023 09:10:05: Session "My server" with join code 690711 and IP 68.39.163.130:2456 is active with 0 player(s)
03/14/2023 09:10:33: PlayFab listen socket child connected to remote player E4D533828E886036
03/14/2023 09:10:33: Player joined server "My server" that has join code 690711, now 1 player(s)
03/14/2023 09:10:33: ZRpc timeout set to 90s
03/14/2023 09:10:33: Muted PlayFab remote player E4D533828E886036
03/14/2023 09:10:33: PlayFab socket with remote ID playfab/E4D533828E886036 received local Platform ID Steam_76561198040782785
03/14/2023 09:10:33: Got handshake from client playfab/E4D533828E886036
03/14/2023 09:10:36: VERSION check their:0.214.2  mine:0.214.2
03/14/2023 09:10:36: Server: New peer connected,sending global keys
03/14/2023 09:10:51: Got character ZDOID from Stuart : 714730644:1
[Debug  :Valheim Discord Connector] Added player Steam_76561198040782785 peer_id:714730644 (Stuart) to joined player list.
03/14/2023 09:10:51: Exception in ZRpc::HandlePackage: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object
  at DiscordConnector.Handlers.Join (ZNetPeer peer) [0x00086] in <547ce46d4ac149049bf315051fe0a73d>:0
  at DiscordConnector.Patches.ZNetPatches+RPC_CharacterID.Postfix (ZRpc rpc, ZDOID characterID) [0x00010] in <547ce46d4ac149049bf315051fe0a73d>:0
  at (wrapper dynamic-method) ZNet.DMD<ZNet::RPC_CharacterID>(ZNet,ZRpc,ZDOID)
  at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <695d1cc93cca45069c528c15c9fdd749>:0
   --- End of inner exception stack trace ---
  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00048] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Delegate.DynamicInvokeImpl (System.Object[] args) [0x000e7] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x00008] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Delegate.DynamicInvoke (System.Object[] args) [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0
  at ZRpc+RpcMethod`1[T].Invoke (ZRpc rpc, ZPackage pkg) [0x0001d] in <95ea79ed82364985aabbad3e62aa8200>:0
  at ZRpc.HandlePackage (ZPackage package) [0x00049] in <95ea79ed82364985aabbad3e62aa8200>:0
  at ZRpc.Update (System.Single dt) [0x0003e] in <95ea79ed82364985aabbad3e62aa8200>:0
03/14/2023 09:10:51: Exception in ZRpc::HandlePackage: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentOutOfRangeException: Start index cannot be less than 0 or greater than input length.
Parameter name: start
  at System.Text.RegularExpressions.Regex.Run (System.Boolean quick, System.Int32 prevlen, System.String input, System.Int32 beginning, System.Int32 length, System.Int32 startat) [0x00020] in <5a2009c85b134970925993880e2ecb2e>:0
  at System.Text.RegularExpressions.Regex.IsMatch (System.String input, System.Int32 startat) [0x00019] in <5a2009c85b134970925993880e2ecb2e>:0
  at System.Text.RegularExpressions.Regex.IsMatch (System.String input) [0x00021] in <5a2009c85b134970925993880e2ecb2e>:0
  at DiscordConnector.Patches.ChatPatches+OnNewChatMessage.Prefix (UnityEngine.GameObject& go, System.Int64& senderID, UnityEngine.Vector3& pos, Talker+Type& type, System.String& user, System.String& text, System.String& senderNetworkUserId) [0x00039] in <547ce46d4ac149049bf315051fe0a73d>:0
  at (wrapper dynamic-method) Chat.DMD<Chat::OnNewChatMessage>(Chat,UnityEngine.GameObject,long,UnityEngine.Vector3,Talker/Type,UserInfo,string,string)
  at Chat.RPC_ChatMessage (System.Int64 sender, UnityEngine.Vector3 position, System.Int32 type, UserInfo userInfo, System.String text, System.String senderAccountId) [0x00000] in <95ea79ed82364985aabbad3e62aa8200>:0
  at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <695d1cc93cca45069c528c15c9fdd749>:0
   --- End of inner exception stack trace ---
  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00048] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Delegate.DynamicInvokeImpl (System.Object[] args) [0x000e7] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x00008] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Delegate.DynamicInvoke (System.Object[] args) [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0
  at RoutedMethod`5[T,U,V,B,K].Invoke (System.Int64 rpc, ZPackage pkg) [0x0001d] in <95ea79ed82364985aabbad3e62aa8200>:0
  at ZRoutedRpc.HandleRoutedRPC (ZRoutedRpc+RoutedRPCData data) [0x00022] in <95ea79ed82364985aabbad3e62aa8200>:0
  at ZRoutedRpc.RPC_RoutedRPC (ZRpc rpc, ZPackage pkg) [0x00023] in <95ea79ed82364985aabbad3e62aa8200>:0
  at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <695d1cc93cca45069c528c15c9fdd749>:0
   --- End of inner exception stack trace ---
  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00048] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Delegate.DynamicInvokeImpl (System.Object[] args) [0x000e7] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x00008] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Delegate.DynamicInvoke (System.Object[] args) [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0
  at ZRpc+RpcMethod`1[T].Invoke (ZRpc rpc, ZPackage pkg) [0x0001d] in <95ea79ed82364985aabbad3e62aa8200>:0
  at ZRpc.HandlePackage (ZPackage package) [0x00049] in <95ea79ed82364985aabbad3e62aa8200>:0
  at ZRpc.Update (System.Single dt) [0x0003e] in <95ea79ed82364985aabbad3e62aa8200>:0
03/14/2023 09:11:20: Exception in ZRpc::HandlePackage: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentOutOfRangeException: Start index cannot be less than 0 or greater than input length.
Parameter name: start
  at System.Text.RegularExpressions.Regex.Run (System.Boolean quick, System.Int32 prevlen, System.String input, System.Int32 beginning, System.Int32 length, System.Int32 startat) [0x00020] in <5a2009c85b134970925993880e2ecb2e>:0
  at System.Text.RegularExpressions.Regex.IsMatch (System.String input, System.Int32 startat) [0x00019] in <5a2009c85b134970925993880e2ecb2e>:0
  at System.Text.RegularExpressions.Regex.IsMatch (System.String input) [0x00021] in <5a2009c85b134970925993880e2ecb2e>:0
  at DiscordConnector.Patches.ChatPatches+OnNewChatMessage.Prefix (UnityEngine.GameObject& go, System.Int64& senderID, UnityEngine.Vector3& pos, Talker+Type& type, System.String& user, System.String& text, System.String& senderNetworkUserId) [0x00039] in <547ce46d4ac149049bf315051fe0a73d>:0
  at (wrapper dynamic-method) Chat.DMD<Chat::OnNewChatMessage>(Chat,UnityEngine.GameObject,long,UnityEngine.Vector3,Talker/Type,UserInfo,string,string)
  at Chat.RPC_ChatMessage (System.Int64 sender, UnityEngine.Vector3 position, System.Int32 type, UserInfo userInfo, System.String text, System.String senderAccountId) [0x00000] in <95ea79ed82364985aabbad3e62aa8200>:0
  at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <695d1cc93cca45069c528c15c9fdd749>:0
   --- End of inner exception stack trace ---
  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00048] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Delegate.DynamicInvokeImpl (System.Object[] args) [0x000e7] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x00008] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Delegate.DynamicInvoke (System.Object[] args) [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0
  at RoutedMethod`5[T,U,V,B,K].Invoke (System.Int64 rpc, ZPackage pkg) [0x0001d] in <95ea79ed82364985aabbad3e62aa8200>:0
  at ZRoutedRpc.HandleRoutedRPC (ZRoutedRpc+RoutedRPCData data) [0x00022] in <95ea79ed82364985aabbad3e62aa8200>:0
  at ZRoutedRpc.RPC_RoutedRPC (ZRpc rpc, ZPackage pkg) [0x00023] in <95ea79ed82364985aabbad3e62aa8200>:0
  at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <695d1cc93cca45069c528c15c9fdd749>:0
   --- End of inner exception stack trace ---
  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00048] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Delegate.DynamicInvokeImpl (System.Object[] args) [0x000e7] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x00008] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Delegate.DynamicInvoke (System.Object[] args) [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0
  at ZRpc+RpcMethod`1[T].Invoke (ZRpc rpc, ZPackage pkg) [0x0001d] in <95ea79ed82364985aabbad3e62aa8200>:0
  at ZRpc.HandlePackage (ZPackage package) [0x00049] in <95ea79ed82364985aabbad3e62aa8200>:0
  at ZRpc.Update (System.Single dt) [0x0003e] in <95ea79ed82364985aabbad3e62aa8200>:0
03/14/2023 09:11:24: Exception in ZRpc::HandlePackage: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentOutOfRangeException: Start index cannot be less than 0 or greater than input length.
Parameter name: start
  at System.Text.RegularExpressions.Regex.Run (System.Boolean quick, System.Int32 prevlen, System.String input, System.Int32 beginning, System.Int32 length, System.Int32 startat) [0x00020] in <5a2009c85b134970925993880e2ecb2e>:0
  at System.Text.RegularExpressions.Regex.IsMatch (System.String input, System.Int32 startat) [0x00019] in <5a2009c85b134970925993880e2ecb2e>:0
  at System.Text.RegularExpressions.Regex.IsMatch (System.String input) [0x00021] in <5a2009c85b134970925993880e2ecb2e>:0
  at DiscordConnector.Patches.ChatPatches+OnNewChatMessage.Prefix (UnityEngine.GameObject& go, System.Int64& senderID, UnityEngine.Vector3& pos, Talker+Type& type, System.String& user, System.String& text, System.String& senderNetworkUserId) [0x00039] in <547ce46d4ac149049bf315051fe0a73d>:0
  at (wrapper dynamic-method) Chat.DMD<Chat::OnNewChatMessage>(Chat,UnityEngine.GameObject,long,UnityEngine.Vector3,Talker/Type,UserInfo,string,string)
  at Chat.RPC_ChatMessage (System.Int64 sender, UnityEngine.Vector3 position, System.Int32 type, UserInfo userInfo, System.String text, System.String senderAccountId) [0x00000] in <95ea79ed82364985aabbad3e62aa8200>:0
  at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <695d1cc93cca45069c528c15c9fdd749>:0
   --- End of inner exception stack trace ---
  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00048] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Delegate.DynamicInvokeImpl (System.Object[] args) [0x000e7] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x00008] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Delegate.DynamicInvoke (System.Object[] args) [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0
  at RoutedMethod`5[T,U,V,B,K].Invoke (System.Int64 rpc, ZPackage pkg) [0x0001d] in <95ea79ed82364985aabbad3e62aa8200>:0
  at ZRoutedRpc.HandleRoutedRPC (ZRoutedRpc+RoutedRPCData data) [0x00022] in <95ea79ed82364985aabbad3e62aa8200>:0
  at ZRoutedRpc.RPC_RoutedRPC (ZRpc rpc, ZPackage pkg) [0x00023] in <95ea79ed82364985aabbad3e62aa8200>:0
  at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <695d1cc93cca45069c528c15c9fdd749>:0
   --- End of inner exception stack trace ---
  at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00048] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Delegate.DynamicInvokeImpl (System.Object[] args) [0x000e7] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x00008] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Delegate.DynamicInvoke (System.Object[] args) [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0
  at ZRpc+RpcMethod`1[T].Invoke (ZRpc rpc, ZPackage pkg) [0x0001d] in <95ea79ed82364985aabbad3e62aa8200>:0
  at ZRpc.HandlePackage (ZPackage package) [0x00049] in <95ea79ed82364985aabbad3e62aa8200>:0
  at ZRpc.Update (System.Single dt) [0x0003e] in <95ea79ed82364985aabbad3e62aa8200>:0
[Debug  :Valheim Discord Connector] Removed player Steam_76561198040782785 peer_id:714730644 (Stuart) from joined player list.
03/14/2023 09:11:28: Exception in ZRpc::HandlePackage: System.NullReferenceException: Object reference not set to an instance of an object
  at DiscordConnector.Handlers.Leave (ZNetPeer peer) [0x000bd] in <547ce46d4ac149049bf315051fe0a73d>:0
  at DiscordConnector.Patches.ZNetPatches+RPC_CharacterID+RPC_Disconnect.Prefix (ZRpc rpc) [0x00017] in <547ce46d4ac149049bf315051fe0a73d>:0
  at (wrapper dynamic-method) ZNet.DMD<ZNet::RPC_Disconnect>(ZNet,ZRpc)
  at ZRpc+RpcMethod.Invoke (ZRpc rpc, ZPackage pkg) [0x00000] in <95ea79ed82364985aabbad3e62aa8200>:0
  at ZRpc.HandlePackage (ZPackage package) [0x00049] in <95ea79ed82364985aabbad3e62aa8200>:0
  at ZRpc.Update (System.Single dt) [0x0003e] in <95ea79ed82364985aabbad3e62aa8200>:0
03/14/2023 09:11:28: Keep socket for playfab/E4D533828E886036, try to reconnect before timeout
03/14/2023 09:11:28: Player connection lost server "My server" that has join code 690711, now 1 player(s)
03/14/2023 09:11:28: PlayFab network error in session 'My server' and network edfa69eb-fb54-46ce-aacb-0f259e33bb4f|AwBhV2Ly6ubhQORQh0GdWaBzXJcggk5vcnRoQ2VudHJhbFVzAAAAAAAAn3aiEpapxSC+Owo1h8qJ5NuEOmtS0oeJqq8h6q5ybZZrblFkbnMtaXI4MWU1LWEzZWMzZjBhLWYxOTQtNDljNC04ZTI3LTE3YzI0MTkzYjJhMi5ub3J0aGNlbnRyYWx1cy5jbG91ZGFwcC5henVyZS5jb20= with type 'Error' and code '4098': the operation was called with an invalid handle
03/14/2023 09:11:28: Failed to send, suspend TX on playfab/E4D533828E886036 while trying to reconnect
ResetParty
Task: LeaveNetworkTask
Task: CleanPartyTask
Task: InitPartyTask()
Task: JoinPartyTask
03/14/2023 09:11:47: Joined PlayFab Party network with ID "edfa69eb-fb54-46ce-aacb-0f259e33bb4f|AwBhV2Ly6ubhQORQh0GdWaBzXJcggk5vcnRoQ2VudHJhbFVzAAAAAAAAn3aiEpapxSC+Owo1h8qJ5NuEOmtS0oeJqq8h6q5ybZZrblFkbnMtaXI4MWU1LWEzZWMzZjBhLWYxOTQtNDljNC04ZTI3LTE3YzI0MTkzYjJhMi5ub3J0aGNlbnRyYWx1cy5jbG91ZGFwcC5henVyZS5jb20="
nwesterhausen commented 1 year ago

Turns out that chat messages don't pass user as a string anymore. They pass a data structure UserInfo. After handling this, no more errors:

03/14/2023 12:45:32: Got handshake from client playfab/E4D533828E886036
03/14/2023 12:46:12: VERSION check their:0.214.2  mine:0.214.2
03/14/2023 12:46:12: Server: New peer connected,sending global keys
03/14/2023 12:46:27: Got character ZDOID from Stuart : 309053364:1
[Debug  :Valheim Discord Connector] Added player Steam_76561198040782785 peer_id:309053364 (Stuart) to joined player list.
[Debug  :Valheim Discord Connector] Trying webhook with payload: {"content":"Stuart has joined."} (event: PlayerJoin)
[Debug  :Valheim Discord Connector] Webhook has 'ALL' enabled
[Debug  :Valheim Discord Connector] Sending PlayerJoin message to Primary Webhook
[Debug  :Valheim Discord Connector] User details: name:Stuart gamerTag: networkUserId:Steam_76561198040782785 DisplayName():Stuart
[Debug  :Valheim Discord Connector] User details: name:Stuart gamerTag: networkUserId:Steam_76561198040782785 DisplayName():Stuart
[Debug  :Valheim Discord Connector] Trying webhook with payload: {"content":"Stuart pings the map. Coords: (-33.5, 40.2, -5.3)"} (event: PlayerPing)
[Debug  :Valheim Discord Connector] Webhook has 'ALL' enabled
[Debug  :Valheim Discord Connector] Sending PlayerPing message to Primary Webhook
[Debug  :Valheim Discord Connector] User details: name:Stuart gamerTag: networkUserId:Steam_76561198040782785 DisplayName():Stuart
[Debug  :Valheim Discord Connector] Trying webhook with payload: {"content":"Stuart shouts **testing**."} (event: PlayerShout)
[Debug  :Valheim Discord Connector] Webhook has 'ALL' enabled
[Debug  :Valheim Discord Connector] Sending PlayerShout message to Primary Webhook
03/14/2023 12:46:55: Got character ZDOID from Stuart : 0:0
[Debug  :Valheim Discord Connector] Steam_76561198040782785 already exists in list of joined players.
03/14/2023 12:46:55: Got character ZDOID from Stuart : 309053364:17
[Debug  :Valheim Discord Connector] Steam_76561198040782785 already exists in list of joined players.
[Debug  :Valheim Discord Connector] Trying webhook with payload: {"content":"Stuart has died for the first time. Coords: (-33.5, 40.2, -5.3)"} (event: PlayerFirstDeath)
[Debug  :Valheim Discord Connector] Webhook has 'ALL' enabled
[Debug  :Valheim Discord Connector] Sending PlayerFirstDeath message to Primary Webhook
[Debug  :Valheim Discord Connector] Removed player Steam_76561198040782785 peer_id:309053364 (Stuart) from joined player list.
[Debug  :Valheim Discord Connector] Trying webhook with payload: {"content":"Stuart has left."} (event: PlayerLeave)
[Debug  :Valheim Discord Connector] Webhook has 'ALL' enabled
[Debug  :Valheim Discord Connector] Sending PlayerLeave message to Primary Webhook
03/14/2023 12:47:02: RPC_Disconnect
03/14/2023 12:47:02: Destroying abandoned non persistent zdo 309053364:17 owner 309053364
03/14/2023 12:47:02: Destroying abandoned non persistent zdo 309053364:11 owner 309053364
03/14/2023 12:47:02: Player connection lost server "My server" that has join code 505306, now 0 player(s)