question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot find native method

See original GitHub issue

Version 3.3.2 ScriptHookV.log reports no errors ScripHookV version: GTA V SCRIPT HOOK (build Jul 23 2021, v1.0.2372.0)

Description The GTA.Game.get_Player() call gives the exception below.

I tried 2 mods: Save vehicles and Save And Load Vehicles Automatically

Below log is for the 2nd mod. First mod gives the exact same error. (except the call stack being different off course)

Any help is appreciated!

[20:54:18] [ERROR] Failed to load config: System.IO.FileNotFoundException: Could not find file 'C:\Program Files (x86)\Steam\steamapps\common\Grand Theft Auto V\ScriptHookVDotNet.ini'.
File name: 'C:\Program Files (x86)\Steam\steamapps\common\Grand Theft Auto V\ScriptHookVDotNet.ini'
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize, Boolean checkHost)
   at System.IO.StreamReader..ctor(String path, Encoding encoding)
   at System.IO.File.InternalReadAllLines(String path, Encoding encoding)
   at ?A0xc1aa4bd5.ScriptHookVDotnet_ManagedInit()
[20:54:18] [DEBUG] Loading API from .\ScriptHookVDotNet2.dll ...
[20:54:18] [DEBUG] Loading API from .\ScriptHookVDotNet3.dll ...
[20:54:18] [DEBUG] Loading scripts from C:\Program Files (x86)\Steam\steamapps\common\Grand Theft Auto V\scripts ...
[20:54:18] [DEBUG] Loading assembly SaveAndLoadVehicles.dll ...
[20:54:18] [INFO] Found 1 script(s) in SaveAndLoadVehicles.dll resolved to API 2.11.2.
[20:54:18] [DEBUG] Instantiating script SaveAndLoadVehicles.Main ...
[20:54:18] [INFO] Started script SaveAndLoadVehicles.Main.
[20:55:24] [ERROR] Caught unhandled exception:
System.MissingMethodException: Method not found: 'UInt64* SHVDN.NativeFunc.Invoke(UInt64, UInt64*, Int32)'.
   at GTA.Native.Function.Call[T](Hash hash)
   at GTA.Game.get_Player()
   at SaveAndLoadVehicles.Utilities.get_PlayerPed()
   at SaveAndLoadVehicles.Main.Main_KeyDown(Object sender, KeyEventArgs e)
   at SHVDN.Script.MainLoop()
[20:55:24] [ERROR] The exception was thrown while executing the script SaveAndLoadVehicles.Main.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
kagikncommented, Dec 11, 2021

As far as I can see from the image, I think it’s because scripthookvdotnet.asi is not updated (new overloads of NativeFunc.Invoke are added in v3.2.0). You need to use the scripthookvdotnet.asi, scripthookvdotnet2.dll, and ``scripthookvdotnet3.dll` the same build archive contains together. As of now, you would want to use the ones from v3.3.2 build unless you encounter some bugs introduced in v3.3.2 or something inconvenient else.

0reactions
lsieben97commented, Dec 11, 2021

Any idea what is causing the above error?

Read more comments on GitHub >

github_iconTop Results From Across the Web

"Native method not found" in android studio
1 Answer 1 · the .so library isn't loaded by the time you called that method , hence java doesn't know about it...
Read more >
How to Handle the UnsatisfiedLinkError Runtime Error in ...
The Java java.lang.UnsatisfiedLinkError is thrown when a program uses a native libaray but is unable to find it at runtime for some reason....
Read more >
Troubleshooting UnsatisfiedLinkError in Java
An UnsatisfiedLinkError is an error that occurs when a Java program cannot find a required native library or DLL. This error can occur...
Read more >
java.lang.UnsatisfiedLinkError: no dll in java.library.path
lang.unsatisfiedlinkerror no lwjgl in java.library.path", which comes when Java doesn't find a native component of the lwjgl.jar library.
Read more >
Java Native Interface (JNI) - Java Programming Tutorial
A native method does not contain a body. The sayHello() shall be found in the native library loaded. The main() method allocates an...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found