The online racing simulator
Lapper crash when using getlistofmods
I am using this piece of code to try and get the list of mods:

updatelistofmods();
$list = getlistofmods();

As soon as the code gets executed, Lapper (7.0.9.0) crashes with the following information:

4/13/2022 2:51:24 PM

Lapper Instance 188.122.74.155/59737 abort!

One or more errors occurred.
mscorlib
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at System.Threading.Tasks.Task`1.get_Result()
at LFSLapper.LFSClient.updatelistofmods(unionVal val, ArrayList args)
at GLScript.GLApp.parseBackcall(SetOfVars GVAR, SetOfVars LVAR, unionVal val, ArrayList args)
at GLScript.Parseur.getval(SetOfVars GVAR, SetOfVars LVAR, executeParsedFunction BC)
at GLScript.GLApp.retrieveEvalVar(String funcName, TokenParse tkparse, TokenBuffer currTokenBuffer, SetOfVars GVAR, SetOfVars LVAR, Boolean breakFunc, Char& breakCar)
at GLScript.GLApp.privExecuteTokensPart(Int32 level, String funcName, SetOfVars GCAR, SetOfVars LVAR, Boolean breakable, Boolean inSwitchCase, Int32 start, Int32 end)
at GLScript.GLApp.privExecuteFunction(String funcName, String[] argsVals)
at GLScript.GLApp.parseBackcall(SetOfVars GVAR, SetOfVars LVAR, unionVal val, ArrayList args)
at GLScript.Parseur.getval(SetOfVars GVAR, SetOfVars LVAR, executeParsedFunction BC)
at GLScript.GLApp.retrieveEvalVar(String funcName, TokenParse tkparse, TokenBuffer currTokenBuffer, SetOfVars GVAR, SetOfVars LVAR, Boolean breakFunc, Char& breakCar)
at GLScript.GLApp.privExecuteTokensPart(Int32 level, String funcName, SetOfVars GCAR, SetOfVars LVAR, Boolean breakable, Boolean inSwitchCase, Int32 start, Int32 end)
at GLScript.GLApp.privExecuteTokensPart(Int32 level, String funcName, SetOfVars GCAR, SetOfVars LVAR, Boolean breakable, Boolean inSwitchCase, Int32 start, Int32 end)
at GLScript.GLApp.privExecuteTokensPart(Int32 level, String funcName, SetOfVars GCAR, SetOfVars LVAR, Boolean breakable, Boolean inSwitchCase, Int32 start, Int32 end)
at GLScript.GLApp.privExecuteTokensPart(Int32 level, String funcName, SetOfVars GCAR, SetOfVars LVAR, Boolean breakable, Boolean inSwitchCase, Int32 start, Int32 end)
at GLScript.GLApp.privExecuteFunction(String funcName, String[] argsVals)
at GLScript.GLApp.executeFunction(String funcName, String[] argsVals)
at Configurator.lexConfigurator.executeFunction(String funcName, infoPlayer pcurrInfoPlayer, String[] par)
at LFSLapper.LFSClient.managePacket(MSO mso)
at LFSLapper.LFSClient.Loop(Connect insimConnection)
at LFSLapper.LFSClient.doloop()
at LapperInstances.LapperInstance.doConnection()
Void ThrowIfExceptional(Boolean)
Closing Instance...

I have added my Client AD and Client Secret to file 'myInc.lpr' but the LFS website says that the API has never been used so far, so it seems it doesn't get called.
Then I checked the file 'addonsused.lpr' and I see this:

#------------------------------------------------------------------------------#
# LFSRestAPI
#------------------------------------------------------------------------------#
include( "./optional/lfsrestapi_Info.lpr");

Weirdly, the mentioned LPR file is not found anywhere in the Lapper directories (no idea if it is needed to get things working for me).
I have found this file "LFSRestAPI.cs" but that's sourcecode.

Any help would be appreciated.
Oke this is odd.

Did you register your LFSLapper? i assume you did.

-Register your LFSLapper @ https://www.lfs.net/account/api
-Fill in your ClientID and ClientSecret in myInc.LPR (includes/myinc.lpr)


If you didn't. I need to add more error messages to prevent crashing.

Could you tell me in which Event/Function you execute that function?

I also couldn't find that lfsrestapi_Info.lpr script, not sure why i kept it there. It has nothing todo with the crash.
Yes, I did register my Lapper, got a client ID and client secret and added both to myinc.lpr , restarted Lapper and executed my code.
I have added the 2 lines mentioned to the following sub event:

Sub Set_Schedule ( $KeyFlags )

That is part of my Set Schedule module and gets executed after giving command: !ss
The first two lines in that event are now:

updatelistofmods();
$list = getlistofmods();

LFS gives a messages about getting the modslist and then Lapper crashes and is restarted.
I did some tests at my server.
It seems LFSLapper crashes if $RestAPIClientID or $RestAPIClientSecret is wrong.

Could you check those please.

bij System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
bij System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
bij System.Threading.Tasks.Task`1.get_Result()
bij LFSLapper.LFSClient.updatelistofmods(unionVal val, ArrayList args)
bij GLScript.GLApp.parseBackcall(SetOfVars GVAR, SetOfVars LVAR, unionVal val, ArrayList args)
bij GLScript.Parseur.getval(SetOfVars GVAR, SetOfVars LVAR, executeParsedFunction BC)
bij GLScript.GLApp.retrieveEvalVar(String funcName, TokenParse tkparse, TokenBuffer currTokenBuffer, SetOfVars GVAR, SetOfVars LVAR, Boolean breakFunc, Char& breakCar)
bij GLScript.GLApp.privExecuteTokensPart(Int32 level, String funcName, SetOfVars GCAR, SetOfVars LVAR, Boolean breakable, Boolean inSwitchCase, Int32 start, Int32 end)
bij GLScript.GLApp.privExecuteTokensPart(Int32 level, String funcName, SetOfVars GCAR, SetOfVars LVAR, Boolean breakable, Boolean inSwitchCase, Int32 start, Int32 end)
bij GLScript.GLApp.privExecuteFunction(String funcName, String[] argsVals)
bij GLScript.GLApp.parseBackcall(SetOfVars GVAR, SetOfVars LVAR, unionVal val, ArrayList args)
bij GLScript.Parseur.getval(SetOfVars GVAR, SetOfVars LVAR, executeParsedFunction BC)
bij GLScript.GLApp.retrieveEvalVar(String funcName, TokenParse tkparse, TokenBuffer currTokenBuffer, SetOfVars GVAR, SetOfVars LVAR, Boolean breakFunc, Char& breakCar)
bij GLScript.GLApp.privExecuteTokensPart(Int32 level, String funcName, SetOfVars GCAR, SetOfVars LVAR, Boolean breakable, Boolean inSwitchCase, Int32 start, Int32 end)
bij GLScript.GLApp.privExecuteFunction(String funcName, String[] argsVals)
bij GLScript.GLApp.executeFunction(String funcName, String[] argsVals)
bij Configurator.lexConfigurator.executeFunction(String funcName, infoPlayer pcurrInfoPlayer, String[] par)
bij LFSLapper.LFSClient.Loop(Connect insimConnection)
bij LFSLapper.LFSClient.doloop()
bij LapperInstances.LapperInstance.doConnection()

[EDIT]
I only created error messages when the ClientID or ClientSecret is empty.
Going to think about proper fixing this crash.
I've send you a private message with my clientID and clientSecret.
All seems to be correct on my end, but when I check API Access Management on this website, it says that my client is never used:

Attached images
Capture.PNG
** Best answer **
This is what my API Application looks like for the Dev LFSLapper

Attached images
APi Info.JPG
Mine looked like this:



I have unchecked the box 'Single Page Application' for the ClientID I had, restarted Lapper but it still crashes.
Then I deleted the ClientID I had and created a one without the 'Single Page Application' box ticked.
I've entered the new CliendID and ClientSecret into myinc.lpr , restarted Lapper , executed my code ... and it still crashes.
Attached images
Capture.PNG
I got it working now.
Just as you did, I entered the Redirect URls:

Attached images
Capture.PNG
This thread is closed

FGED GREDG RDFGDR GSFDG