Skip to content

ScriptHookVDotNet causes ScriptHookV scripts to crash when a C++ exception is thrown #936

@ikt32

Description

@ikt32

Version

  • v2.10.9
  • v2.10.10
  • v3.0.3

I'm not going back further but I vaguely remember it using to work...

Description
In a C++ script:

void update() {
	try {
		if (GAMEPLAY::_HAS_CHEAT_STRING_JUST_BEEN_ENTERED(GAMEPLAY::GET_HASH_KEY((char*)"throw"))) {
			throw std::logic_error("catch me!");
		}
	}
	catch(std::logic_error& ex) {
		showNotification(std::string("Caught A: ") + ex.what());
	}
	catch (std::exception& ex) {
		showNotification(std::string("Caught B: ") + ex.what());
	}
	catch(...) {
		showNotification("Caught C");
	}
}

Test 1:

Have just the .asi installed. Enter "throw" in the cheat console.

Expect: C++ exception is caught in the first catch block. A notification is shown indicating that.

Actual: C++ exception is caught in the first catch block. A notification is shown indicating that.

Test 2:

Have also SHVDN installed. Enter "throw" in the cheat console.

Expect: C++ exception is caught in the first catch block. A notification is shown indicating that.

Actual: SHV informs the .asi has crashed. No notification is shown.

ASI that throws on the "throw" cheat: ThrowException.zip (Source)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis is a bug (not for CI issues)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions