Jump to content
RAGE Multiplayer Community

NAPI Crashes with System.Reflection.TargetParameterCountException


enisn
 Share

Recommended Posts

Server crashed with no message when a player connected. 

 

In the logs I could't find something, but there is no StackTrace in logs and I can not understand anything.

==================[9.12.2018 12:46:10]==================
System.Reflection.TargetParameterCountException: Parameter count mismatch.
   at object[] System.Reflection.RuntimeMethodInfo.InvokeArgumentsCheck(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture)
=========================================================

 

Most probably reason is a Event takes only 1 argument but API tries to put it as object[] like:

(via: System.Reflection.TargetParameterCountException: Parameter count mismatch on StackoverFlow)


var obj = "MyParam1"; //Comes from client 

//uses this
method.Invoke(instance, obj);

//instead of this.
method.Invoke(instance, new [] { obj });

//or this control doesn't exist
if(obj is IEnumerable)
 method.Invoke(instance, obj);
else
 method.Invoke(instance, new [] { obj });

 

I really can't find the problem. Log isn't enough to find exception. Because exception throws in external assembly and it doesn't have information enough.

 

-- EDIT--

I've commented all ServerEvents, and there is no problem. I tried uncomment one by one, but I recognized, I can't use any of ServerEvent. 

I uncommented PlayerConnected and crashed again when player connects. same thing happens PlayerDisconnected.

 Reflection doesn't triggers my ServerEvents. Can I handle events with different way instead of Attributes ?

--------

Edited by enisn
Link to comment
Share on other sites

  • 3 weeks later...
  • 1 month later...

Solution?

 

EDIT: THe solution seems to be to copy Bootstrapper.dll from bridge_package.zip to NuGet package folder, aka C:\Users\KevY\.nuget\packages\gtanetwork.api\0.3.6\lib\netcoreapp2.0

Edited by KevY
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...