Skip to content

Remote export not called #35

@JLFSL

Description

@JLFSL

What happened?

When trying to call an export with remote binding from the client to the server, an exception occurs that the object reference is not set to an instance.

I'm thinking that by looking at Exports.cs, it seems like REMOTE_FUNCTION_ENABLED is false. My code should be perfectly fine.

Client call

string json = await Exports["serverresource", "dosomething"]();

Example server export

[Export("dosomething", Binding.Remote)]
public string DoSomething()
{
    return "{}";
}

Client logs

[    646110] [b2944_GTAProce]             MainThrd/ System.NullReferenceException: Object reference not set to an instance of an object.
[    646110] [b2944_GTAProce]             MainThrd/   at NRP_JobManager.Client.Handlers.JobHandler+<SingleJobTick>d__5.MoveNext () [0x00557] in <190051bc189e4252990e44c10ec23095>:0 
[    646110] [b2944_GTAProce]             MainThrd/ --- End of stack trace from previous location where exception was thrown ---
[    646110] [b2944_GTAProce]             MainThrd/   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <b575c7ac070e41ffa0751333b6ac9f42>:0 
[    646110] [b2944_GTAProce]             MainThrd/   at CitizenFX.Core.Coroutine.GetResult () [0x00000] in C:\gl\builds\cfx-fivem\master\fivem\code\client\clrcore-v2\Coroutine\Coroutine.cs:201 
[    646110] [b2944_GTAProce]             MainThrd/   at CitizenFX.Core.CoroutineAwaiter.GetResult () [0x00000] in C:\gl\builds\cfx-fivem\master\fivem\code\client\clrcore-v2\Coroutine\Coroutine.cs:296 
[    646110] [b2944_GTAProce]             MainThrd/   at CitizenFX.Core.CoroutineRepeat+<Execute>d__6.MoveNext () [0x00032] in C:\gl\builds\cfx-fivem\master\fivem\code\client\clrcore-v2\Coroutine\CoroutineRepeat.cs:41 

Expected result

The export to be called, thus returning data.

Reproduction steps

1. Create a server export with a remote binding
2. Call this export from the client script of another resource

Importancy

Can't use this feature until fixed

Specific version

FiveM, latest as of today

Extra

This might also be a misunderstanding of the available documentation as of now, but I suspect it as a bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions