Artifact-Version: 4998
Server-Version: Ubuntu 20.04
C# Framework: .NET 4.5.2
This is the error:
Unhandled exception in Mono script environment: System.NullReferenceException: Object reference not set to an instance of an object
at CitizenFX.Core.IdentifierCollection+<>c__DisplayClass5_0.<get_Item>b__0 (System.String id) [0x00000] in /src/code/client/clrcore/Server/ServerWrappers.cs:139
at System.Linq.Enumerable.TryGetFirst[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] predicate, System.Boolean& found) [0x0003f] in <621f44bf32b74ec7bfd50971222435b4>:0
at System.Linq.Enumerable.FirstOrDefault[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] predicate) [0x00000] in <621f44bf32b74ec7bfd50971222435b4>:0
at CitizenFX.Core.IdentifierCollection.get_Item (System.String type) [0x0000d] in /src/code/client/clrcore/Server/ServerWrappers.cs:139
at KeyinatorServer.MysqlManager.Death (CitizenFX.Core.Player p) [0x00065] in E:\Repos\KeyinatorClient\KeyinatorServer\MysqlManager.cs:30
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__6_1 (System.Object state) [0x00000] in <9391d7651e69459eae268d8a1dfa670f>:0
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem () [0x00008] in <9391d7651e69459eae268d8a1dfa670f>:0
at System.Threading.ThreadPoolWorkQueue.Dispatch () [0x00074] in <9391d7651e69459eae268d8a1dfa670f>:0
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback () [0x00000] in <9391d7651e69459eae268d8a1dfa670f>:0
at CitizenFX.Core.IdentifierCollection+<>c__DisplayClass5_0.<get_Item>b__0 (System.String id) [0x00000] in /src/code/client/clrcore/Server/ServerWrappers.cs:139
at System.Linq.Enumerable.TryGetFirst[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] predicate, System.Boolean& found) [0x0003f] in <621f44bf32b74ec7bfd50971222435b4>:0
at System.Linq.Enumerable.FirstOrDefault[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] predicate) [0x00000] in <621f44bf32b74ec7bfd50971222435b4>:0
at CitizenFX.Core.IdentifierCollection.get_Item (System.String type) [0x0000d] in /src/code/client/clrcore/Server/ServerWrappers.cs:139
at KeyinatorServer.MysqlManager.Death (CitizenFX.Core.Player p) [0x00065] in E:\Repos\KeyinatorClient\KeyinatorServer\MysqlManager.cs:30
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__6_1 (System.Object state) [0x00000] in <9391d7651e69459eae268d8a1dfa670f>:0
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem () [0x00008] in <9391d7651e69459eae268d8a1dfa670f>:0
at System.Threading.ThreadPoolWorkQueue.Dispatch () [0x00074] in <9391d7651e69459eae268d8a1dfa670f>:0
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback () [0x00000] in <9391d7651e69459eae268d8a1dfa670f>:0
And this is the server-sided C# Code:
namespace ServerRessource {
class MysqlManager : BaseScript {
[EventHandler("Keyinator:MysqlManager:kill")]
private async void Kill([FromSource] Player p) {
await Delay(0);
string steam = p?.Identifiers?["steam"];
if (steam == null) return;
MysqlSupervisor_KD.AddKill(steam);
p.State["kills"] = p.State["kills"] + 1;
}
[EventHandler("Keyinator:MysqlManager:death")]
private async void Death([FromSource] Player p) {
await Delay(0);
string steam = p?.Identifiers?["steam"]; //<-- This is line 30
if (steam == null) return;
MysqlSupervisor_KD.AddDeath(steam);
p.State["deaths"] = p.State["deaths"] + 1;
}
}
}
I have tried the code with/without the Delay(0), as async Task, etc.
I also get the same error in other parts of the code.
The error is very rare and happens once every ~2000 player connections since last restart.