fivem icon indicating copy to clipboard operation
fivem copied to clipboard

[MonoV2] System.MethodAccessException

Open Keyinator opened this issue 6 months ago • 0 comments

What happened?

When writing a nuicallback function in C# using MonoRT2 you receive the following error:

SCRIPT ERROR: Could not invoke reference function ReplicateMethodAccessException.Class1.NuiCallback^7
Failed with exception:
System.MethodAccessException: Transparent method CitizenFX.Core._LocalFunction:Invoke (object[]) cannot call Critical method CitizenFX.Core.ScriptInterface:InvokeFunctionReference (string,byte[]).
at System.Security.SecurityManager.ThrowException (System.Exception ex) [0x00000] in <b575c7ac070e41ffa0751333b6ac9f42>:0 
at CitizenFX.Core._LocalFunction.Invoke (System.Object[] args) [0x00000] in C:\gl\builds\cfx-fivem\master\fivem\code\client\clrcore-v2\Interop\LocalFunction.cs:46 
at ReplicateMethodAccessException.Class1.NuiCallback (System.Collections.Generic.IDictionary`2[TKey,TValue] data, CitizenFX.Core.Callback cb) [0x00010] in <d3ff6d2a0a4a4c26b3833d8cbf6e50fa>:0 
at (wrapper dynamic-method) System.Object:ReplicateMethodAccessException.Class1.NuiCallback (object,CitizenFX.Core.Remote,object[])
at CitizenFX.Core.ReferenceFunctionManager.Invoke (System.Int32 reference, System.Byte* arguments, System.UInt32 argsSize) [0x00024] in C:\gl\builds\cfx-fivem\master\fivem\code\client\clrcore-v2\Interop\ReferenceFunctionManager.cs:147 ^7

Expected result

No issue should appear

Reproduction steps

Reproduction repository can be found at https://github.com/Keyinator/Fivem-ReplicateMethodAccessException

Importancy

Slight inconvenience

Area(s)

FiveM, ScRT: C#

Specific version(s)

FiveM Client on Windows (Beta and Latest)

Additional information

No response

Keyinator avatar Aug 25 '24 13:08 Keyinator