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] System.MethodAccessException #2749

Closed
Keyinator opened this issue Aug 25, 2024 · 0 comments · Fixed by #2778
Closed

[MonoV2] System.MethodAccessException #2749

Keyinator opened this issue Aug 25, 2024 · 0 comments · Fixed by #2778
Labels
bug ScRT: C# Issues/PRs related to either C# scripting runtimes

Comments

@Keyinator
Copy link
Contributor

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 Keyinator added bug triage Needs a preliminary assessment to determine the urgency and required action labels Aug 25, 2024
@github-actions github-actions bot added the ScRT: C# Issues/PRs related to either C# scripting runtimes label Aug 25, 2024
@github-actions github-actions bot removed the triage Needs a preliminary assessment to determine the urgency and required action label Oct 3, 2024
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant