Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MonoV2] Event listeners with a byte[] as a parameter fail to register #2571

Open
ruigouveiamaciel opened this issue Jun 1, 2024 · 2 comments · May be fixed by citizenfx/msgpack-cs#1
Open
Labels
bug ScRT: C# Issues/PRs related to either C# scripting runtimes triage Needs a preliminary assessment to determine the urgency and required action

Comments

@ruigouveiamaciel
Copy link

ruigouveiamaciel commented Jun 1, 2024

What happened?

Events that take byte arrays as a parameter fail when registering (past build 8380).

public class ExampleServerScript : BaseScript
{
	[EventHandler("exampleEvent", Binding.Remote)]
	private static void HandleIncomingRequest([Source] Player player, byte[] data)
	{
		Debug.WriteLine("Hello World");
	}
}
[rcon/script:Placehol] Registering CitizenFX.Core.EventHandler PlaceholderRP.Server.Hooks.Hooks.HandleIncomingRequest failed with exception: System.ArgumentException: Bad type def, can't handle '>' at 28
[rcon/script:Placehol] Parameter name: typeName
[rcon/script:Placehol]   at System.TypeSpec.Parse (System.String name, System.Int32& p, System.Boolean is_recurse, System.Boolean allow_aqn) [0x004f5] in <fbc4ec45371543bfba3678ebb82caf6d>:0
[rcon/script:Placehol]   at System.TypeSpec.Parse (System.String typeName) [0x00010] in <fbc4ec45371543bfba3678ebb82caf6d>:0
[rcon/script:Placehol]   at System.Reflection.Emit.ModuleBuilder.GetType (System.String className, System.Boolean throwOnError, System.Boolean ignoreCase) [0x00037] in <fbc4ec45371543bfba3678ebb82caf6d>:0
[rcon/script:Placehol]   at System.Reflection.Emit.ModuleBuilder.GetType (System.String className) [0x00000] in <fbc4ec45371543bfba3678ebb82caf6d>:0
[rcon/script:Placehol]   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
[rcon/script:Placehol]   at CitizenFX.MsgPack.MsgPackRegistry.CreateSerializer (System.Type type) [0x0002a] in C:\gl\builds\cfx-fivem\master\fxserver\vendor\msgpack-cs\MsgPack\MsgPackRegistry.cs:190
[rcon/script:Placehol]   at CitizenFX.MsgPack.MsgPackRegistry.GetOrCreateDeserializer (System.Type type) [0x00000] in C:\gl\builds\cfx-fivem\master\fxserver\vendor\msgpack-cs\MsgPack\MsgPackRegistry.cs:174
[rcon/script:Placehol]   at CitizenFX.MsgPack.MsgPackDeserializer.ConstructDelegate (System.Object target, System.Reflection.MethodInfo method) [0x0022b] in C:\gl\builds\cfx-fivem\master\fxserver\vendor\msgpack-cs\MsgPack\MsgPackFunc.cs:124
[rcon/script:Placehol]   at CitizenFX.MsgPack.MsgPackDeserializer.CreateDelegate (System.Object target, System.Reflection.MethodInfo method) [0x000a0] in C:\gl\builds\cfx-fivem\master\fxserver\vendor\msgpack-cs\MsgPack\MsgPackFunc.cs:39
[rcon/script:Placehol]   at CitizenFX.Core.BaseScript.Initialize () [0x000a4] in C:\gl\builds\cfx-fivem\master\fxserver\code\client\clrcore-v2\BaseScript.cs:97
[rcon/script:Placehol] Instantiated instance of script PlaceholderRP.Server.AdminQOL.AdminCommands.

Expected result

Event should not fail to register

Reproduction steps

  1. Use build 8385 of FxServer

  2. Make a resource that uses MonoV2

  3. Add this script to your resource and watch the server/client fail to register it

public class ExampleServerScript : BaseScript
{
	[EventHandler("exampleEvent", Binding.Remote)]
	private static void HandleIncomingRequest(Player player, byte[] data)
	{
		Debug.WriteLine("Hello World");
	}
}

Importancy

Slight inconvenience

Area(s)

ScRT: C#

Specific version(s)

Server 8380 Windows

Additional information

No response

@ruigouveiamaciel ruigouveiamaciel added bug triage Needs a preliminary assessment to determine the urgency and required action labels Jun 1, 2024
@github-actions github-actions bot added the ScRT: C# Issues/PRs related to either C# scripting runtimes label Jun 1, 2024
@ruigouveiamaciel ruigouveiamaciel linked a pull request Jun 9, 2024 that will close this issue
@FabianTerhorst
Copy link
Contributor

Try again on latest build.

@DaniGP17
Copy link
Contributor

This was already solved with the msgpack reverted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug ScRT: C# Issues/PRs related to either C# scripting runtimes triage Needs a preliminary assessment to determine the urgency and required action
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants