When executing the following code on the server on the latest server build 8439/windows the following output/error is being generated:
Code:
namespace server
{
public class TestClass
{
public int TestNumber { get; set; }
public string TestString { get; set; }
public bool TestBool { get; set; }
}
public class Server : BaseScript
{
public List<TestClass> TestElements = [
new TestClass { TestNumber = 1, TestString = "Test1", TestBool = true },
new TestClass { TestNumber = 2, TestString = "Test2", TestBool = false },
new TestClass { TestNumber = 3, TestString = "Test3", TestBool = true }
];
public Server()
{
Debug.WriteLine($"Server script started. Setting value of Global StateBag 'test' to: {JsonConvert.SerializeObject(TestElements)}");
StateBag.Global.Set("test", TestElements, true);
}
}
}
Error:
[ c-scripting-core] Creating script environments for mrp
[ script:mrp] Server script started. Setting value of Global StateBag 'test' to: [{"TestNumber":1,"TestString":"Test1","TestBool":true},{"TestNumber":2,"TestString":"Test2","TestBool":false},{"TestNumber":3,"TestString":"Test3","TestBool":true}]
[ script:mrp] Failed to instantiate instance of script server.Server: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: Bad type def, can't handle '>' at 139
[ script:mrp] Parameter name: typeName
[ script:mrp] at System.TypeSpec.Parse (System.String name, System.Int32& p, System.Boolean is_recurse, System.Boolean allow_aqn) [0x004f5] in <fbc4ec45371543bfba3678ebb82caf6d>:0
[ script:mrp] at System.TypeSpec.Parse (System.String typeName) [0x00010] in <fbc4ec45371543bfba3678ebb82caf6d>:0
[ script:mrp] at System.Reflection.Emit.ModuleBuilder.GetType (System.String className, System.Boolean throwOnError, System.Boolean ignoreCase) [0x00037] in <fbc4ec45371543bfba3678ebb82caf6d>:0
[ script:mrp] at System.Reflection.Emit.ModuleBuilder.GetType (System.String className) [0x00000] in <fbc4ec45371543bfba3678ebb82caf6d>:0
[ script:mrp] at CitizenFX.MsgPack.Formatters.ArrayFormatter.Build (System.Type type, System.Type typeArray) [0x00016] in C:\gl\builds\cfx-fivem\master\fxserver\vendor\msgpack-cs\MsgPack\Formatters\ArrayFormatter.cs:17
[ script:mrp] at CitizenFX.MsgPack.MsgPackRegistry.CreateSerializer (System.Type type) [0x00066] in C:\gl\builds\cfx-fivem\master\fxserver\vendor\msgpack-cs\MsgPack\MsgPackRegistry.cs:201
[ script:mrp] at CitizenFX.MsgPack.MsgPackRegistry.Serialize (CitizenFX.MsgPack.MsgPackSerializer serializer, System.Object obj) [0x0018a] in C:\gl\builds\cfx-fivem\master\fxserver\vendor\msgpack-cs\MsgPack\MsgPackRegistry.cs:143
[ script:mrp] at CitizenFX.MsgPack.MsgPackSerializer.Serialize (System.Object v) [0x00000] in C:\gl\builds\cfx-fivem\master\fxserver\vendor\msgpack-cs\MsgPack\MsgPackSerializer.cs:70
[ script:mrp] at CitizenFX.MsgPack.MsgPackSerializer.SerializeToByteArray (System.Object value) [0x00005] in C:\gl\builds\cfx-fivem\master\fxserver\vendor\msgpack-cs\MsgPack\MsgPackSerializer.cs:59
[ script:mrp] at CitizenFX.Core.Native.InPacket..ctor (System.Object obj) [0x00000] in C:\gl\builds\cfx-fivem\master\fxserver\code\client\clrcore-v2\Native\Types\NativeTypes.cs:80
[ script:mrp] at CitizenFX.Core.Native.InPacket.Serialize (System.Object obj) [0x00000] in C:\gl\builds\cfx-fivem\master\fxserver\code\client\clrcore-v2\Native\Types\NativeTypes.cs:81
[ script:mrp] at CitizenFX.Core.StateBag.Set (System.String key, System.Object data, System.Boolean replicate) [0x00000] in C:\gl\builds\cfx-fivem\master\fxserver\code\client\clrcore-v2\StateBag.cs:19
[ script:mrp] at server.Server..ctor () [0x000a7] in D:\veryinsanee.space\FiveM\Millitary RP\millitary_rp\server\Server.cs:36
[ script:mrp] at (wrapper managed-to-native) System.Reflection.RuntimeConstructorInfo.InternalInvoke(System.Reflection.RuntimeConstructorInfo,object,object[],System.Exception&)
[ script:mrp] at System.Reflection.RuntimeConstructorInfo.InternalInvoke (System.Object obj, System.Object[] parameters, System.Boolean wrapExceptions) [0x00005] in <fbc4ec45371543bfba3678ebb82caf6d>:0
[ script:mrp] Exception_EndOfInnerExceptionStack
[ script:mrp] at System.Reflection.RuntimeConstructorInfo.InternalInvoke (System.Object obj, System.Object[] parameters, System.Boolean wrapExceptions) [0x0001a] in <fbc4ec45371543bfba3678ebb82caf6d>:0
[ script:mrp] at System.RuntimeType.CreateInstanceMono (System.Boolean nonPublic, System.Boolean wrapExceptions) [0x00095] in <fbc4ec45371543bfba3678ebb82caf6d>:0
[ script:mrp] at System.RuntimeType.CreateInstanceSlow (System.Boolean publicOnly, System.Boolean wrapExceptions, System.Boolean skipCheckThis, System.Boolean fillCache) [0x00009] in <fbc4ec45371543bfba3678ebb82caf6d>:0
[ script:mrp] at System.RuntimeType.CreateInstanceDefaultCtor (System.Boolean publicOnly, System.Boolean skipCheckThis, System.Boolean fillCache, System.Boolean wrapExceptions, System.Threading.StackCrawlMark& stackMark) [0x00027] in <fbc4ec45371543bfba3678ebb82caf6d>:0
[ script:mrp] at System.Activator.CreateInstance (System.Type type, System.Boolean nonPublic, System.Boolean wrapExceptions) [0x00020] in <fbc4ec45371543bfba3678ebb82caf6d>:0
[ script:mrp] at System.Activator.CreateInstance (System.Type type, System.Boolean nonPublic) [0x00000] in <fbc4ec45371543bfba3678ebb82caf6d>:0
[ script:mrp] at System.Activator.CreateInstance (System.Type type) [0x00000] in <fbc4ec45371543bfba3678ebb82caf6d>:0
[ script:mrp] at CitizenFX.Core.ScriptManager.LoadScripts (System.Reflection.Assembly assembly) [0x00088] in C:\gl\builds\cfx-fivem\master\fxserver\code\client\clrcore-v2\ScriptManager.cs:79
[ c-scripting-mono-v2] Warning: Assembly server/mrp_server.net.dll has been loaded into the mono rt2 runtime. This runtime is still in beta and shouldn't be used in production, crashes and breaking changes are to be expected.
[ resources] Started resource mrp
Expected result
Set the value of the state bag to the list. Before the "msgpack replace" everything worked fine and as expected.
Reproduction steps
1. Use the following code I've written above.
2. Start the server on the latest server artifact.
What happened?
When executing the following code on the server on the latest server build 8439/windows the following output/error is being generated:
Code:
Error:
Expected result
Set the value of the state bag to the list. Before the "msgpack replace" everything worked fine and as expected.
Reproduction steps
Importancy
Fatal (we can't use the runtime without)
Specific version
Server 8439 windows
Extra
No response