Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request textDocument/hover failed (index out of bounds) #405

Open
MAGNAT2645 opened this issue Jun 12, 2024 · 8 comments
Open

Request textDocument/hover failed (index out of bounds) #405

MAGNAT2645 opened this issue Jun 12, 2024 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@MAGNAT2645
Copy link

MAGNAT2645 commented Jun 12, 2024

Basic informations

  • OS: [Arch Linux]
  • VSCodium version: Latest
  • Extension version: Latest

Further Information

Very often I see Request textDocument/hover failed error when hovering at something.
For example:

#define cast(%0,%1) view_as<%0>(%1)
#define _INT(%0)    cast( int, %0 )
#define THIS_INDEX  _INT( this )

#if defined _aon_store_inventory_included
methodmap ISmiteBossPlayer < StorePlayer
#else
methodmap ISmiteBossPlayer
#endif
{
    public void SmiteArea(AbilityData abilityData) // error when hovering at SmiteArea and abilityData
    {
        float aimPosition[3]; // error when hovering at aimPosition
        GetClientAimPosition(THIS_INDEX, aimPosition); // here hovering at aimPosition works fine
        
...

But same code does not throw such errors if you move it to the main file.

Panic context:
> 
version: 0.13.0
request: textDocument/hover HoverParams {
    text_document_position_params: TextDocumentPositionParams {
        text_document: TextDocumentIdentifier {
            uri: Url {
                scheme: "file",
                cannot_be_a_base: false,
                username: "",
                password: None,
                host: None,
                port: None,
                path: "/home/ivan/GitHub/AON/FF2_AbilityPack1/scripting/aon/ff2_aon_pack1/smite.sp",
                query: None,
                fragment: None,
            },
        },
        position: Position {
            line: 8,
            character: 18,
        },
    },
    work_done_progress_params: WorkDoneProgressParams {
        work_done_token: None,
    },
}

thread 'Worker' panicked at crates/hir-def/src/ast_id_map.rs:207:19:
index out of bounds: the len is 291 but the index is 496
stack backtrace:
   0:     0x597075ad6d12 - std::backtrace_rs::backtrace::libunwind::trace::he4ee80166a02c846
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/../../backtrace/src/backtrace/libunwind.rs:105:5
   1:     0x597075ad6d12 - std::backtrace_rs::backtrace::trace_unsynchronized::h476faccf57e88641
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x597075ad6d12 - std::sys_common::backtrace::_print_fmt::h430c922a77e7a59c
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x597075ad6d12 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hffecb437d922f988
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x597075b04a7c - core::fmt::rt::Argument::fmt::hf3df69369399bfa9
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/fmt/rt.rs:142:9
   5:     0x597075b04a7c - core::fmt::write::hd9a8d7d029f9ea1a
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/fmt/mod.rs:1153:17
   6:     0x597075ad361f - std::io::Write::write_fmt::h0e1226b2b8d973fe
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/io/mod.rs:1843:15
   7:     0x597075ad6ae4 - std::sys_common::backtrace::_print::hd2df4a083f6e69b8
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x597075ad6ae4 - std::sys_common::backtrace::print::he907f6ad7eee41cb
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x597075ad868b - std::panicking::default_hook::{{closure}}::h3926193b61c9ca9b
  10:     0x597075ad83e3 - std::panicking::default_hook::h25ba2457dea68e65
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panicking.rs:292:9
  11:     0x5970758cf4d4 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hb56d6207bc7c5eee
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/alloc/src/boxed.rs:2034:9
  12:     0x5970758cf4d4 - stdx::panic_context::PanicContext::init::{{closure}}::{{closure}}::h583ebea7f0e533b4
                               at /home/runner/work/sourcepawn-vscode/sourcepawn-vscode/crates/stdx/src/panic_context.rs:31:17
  13:     0x5970758cf4d4 - stdx::panic_context::with_ctx::{{closure}}::h67057e5f73f92263
                               at /home/runner/work/sourcepawn-vscode/sourcepawn-vscode/crates/stdx/src/panic_context.rs:48:20
  14:     0x5970758cf4d4 - std::thread::local::LocalKey<T>::try_with::h6258b3304cf9f68c
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/thread/local.rs:284:16
  15:     0x5970758cf4d4 - std::thread::local::LocalKey<T>::with::h59c2abb143e6b391
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/thread/local.rs:260:9
  16:     0x5970758cf4d4 - stdx::panic_context::with_ctx::hca5841cf8cfab3ef
                               at /home/runner/work/sourcepawn-vscode/sourcepawn-vscode/crates/stdx/src/panic_context.rs:48:9
  17:     0x5970758cf4d4 - stdx::panic_context::PanicContext::init::{{closure}}::h3d497e5f9af2d848
                               at /home/runner/work/sourcepawn-vscode/sourcepawn-vscode/crates/stdx/src/panic_context.rs:24:13
  18:     0x597075ad8cc0 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h022ca2c0d8c21c9e
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/alloc/src/boxed.rs:2034:9
  19:     0x597075ad8cc0 - std::panicking::rust_panic_with_hook::h0ad14d90dcf5224f
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panicking.rs:783:13
  20:     0x597075ad8a02 - std::panicking::begin_panic_handler::{{closure}}::h4a1838a06f542647
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panicking.rs:657:13
  21:     0x597075ad71e6 - std::sys_common::backtrace::__rust_end_short_backtrace::h77cc4dc3567ca904
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/sys_common/backtrace.rs:171:18
  22:     0x597075ad8734 - rust_begin_unwind
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panicking.rs:645:5
  23:     0x59707503f625 - core::panicking::panic_fmt::h940d4fd01a4b4fd1
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/panicking.rs:72:14
  24:     0x59707503f812 - core::panicking::panic_bounds_check::h9bb22f08a42e1ac8
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/panicking.rs:209:5
  25:     0x5970757d235d - <hir_def::MethodmapId as hir_def::child_by_source::ChildBySource>::child_by_source_to::{{closure}}::hfce39000ce197306
  26:     0x5970757d235d - core::iter::traits::iterator::Iterator::for_each::call::{{closure}}::h02c6043e8f46de22
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/iter/traits/iterator.rs:814:29
  27:     0x5970757d235d - core::iter::adapters::map::map_fold::{{closure}}::hc443969d458050ff
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/iter/adapters/map.rs:89:21
  28:     0x5970757d235d - <core::iter::adapters::enumerate::Enumerate<I> as core::iter::traits::iterator::Iterator>::fold::enumerate::{{closure}}::h90c484b47d738f57
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/iter/adapters/enumerate.rs:107:27
  29:     0x5970757d235d - <core::slice::iter::Iter<T> as core::iter::traits::iterator::Iterator>::fold::hf99219caf056cd0d
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/slice/iter/macros.rs:232:27
  30:     0x5970757d235d - <core::iter::adapters::enumerate::Enumerate<I> as core::iter::traits::iterator::Iterator>::fold::h37371acd2be708f7
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/iter/adapters/enumerate.rs:113:9
  31:     0x5970757d235d - <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold::hd1e82a559a3b956c
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/iter/adapters/map.rs:129:19
  32:     0x5970757d235d - core::iter::traits::iterator::Iterator::for_each::h2b35cf70c7c0d468
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/iter/traits/iterator.rs:817:14
  33:     0x5970757d235d - <hir_def::MethodmapId as hir_def::child_by_source::ChildBySource>::child_by_source_to::h75b6d5c2342ac867
                               at /home/runner/work/sourcepawn-vscode/sourcepawn-vscode/crates/hir-def/src/child_by_source.rs:155:27
  34:     0x59707578e6bc - hir_def::child_by_source::ChildBySource::child_by_source::h0081bcaaebb813f2
                               at /home/runner/work/sourcepawn-vscode/sourcepawn-vscode/crates/hir-def/src/child_by_source.rs:15:9
  35:     0x59707578e6bc - hir::source_to_def::ChildContainer::child_by_source::h08d6b6781a789914
                               at /home/runner/work/sourcepawn-vscode/sourcepawn-vscode/crates/hir/src/source_to_def.rs:223:48
  36:     0x59707578e6bc - hir::source_to_def::SourceToDefCtx::cache_for::{{closure}}::h09ac0b994feb47b3
                               at /home/runner/work/sourcepawn-vscode/sourcepawn-vscode/crates/hir/src/source_to_def.rs:101:32
  37:     0x59707578e6bc - std::collections::hash::map::Entry<K,V>::or_insert_with::hca99bc3cb3fb4f3f
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/collections/hash/map.rs:2666:43
  38:     0x59707578e6bc - hir::source_to_def::SourceToDefCtx::cache_for::ha2bd7d6054e796c7
                               at /home/runner/work/sourcepawn-vscode/sourcepawn-vscode/crates/hir/src/source_to_def.rs:99:9
  39:     0x59707578e6bc - hir::source_to_def::SourceToDefCtx::dyn_map::h4d2835d42d37b9f0
                               at /home/runner/work/sourcepawn-vscode/sourcepawn-vscode/crates/hir/src/source_to_def.rs:94:14
  40:     0x59707578ea54 - hir::source_to_def::SourceToDefCtx::to_def::h4a13553f5f5ae4d7
                               at /home/runner/work/sourcepawn-vscode/sourcepawn-vscode/crates/hir/src/source_to_def.rs:89:9
  41:     0x59707578ea54 - hir::source_to_def::SourceToDefCtx::fn_to_def::hfddab534321855c0
                               at /home/runner/work/sourcepawn-vscode/sourcepawn-vscode/crates/hir/src/source_to_def.rs:27:9
  42:     0x59707578ea54 - hir::source_to_def::SourceToDefCtx::find_container::hcbaa42e298a0d648
                               at /home/runner/work/sourcepawn-vscode/sourcepawn-vscode/crates/hir/src/source_to_def.rs:123:25
  43:     0x59707578e244 - hir::source_to_def::SourceToDefCtx::local_to_def::hd5418c859f8b4055
                               at /home/runner/work/sourcepawn-vscode/sourcepawn-vscode/crates/hir/src/source_to_def.rs:73:25
  44:     0x59707578b3fc - hir::semantics::SemanticsImpl::local_to_def::{{closure}}::h1ff635a6402d5f3c
                               at /home/runner/work/sourcepawn-vscode/sourcepawn-vscode/crates/hir/src/semantics.rs:777:33
  45:     0x59707578b3fc - hir::semantics::SemanticsImpl::with_ctx::h362d4a6790092f21
                               at /home/runner/work/sourcepawn-vscode/sourcepawn-vscode/crates/hir/src/semantics.rs:796:9
  46:     0x59707578b3fc - hir::semantics::SemanticsImpl::local_to_def::h223f68f4f5259196
                               at /home/runner/work/sourcepawn-vscode/sourcepawn-vscode/crates/hir/src/semantics.rs:777:13
  47:     0x59707572dd22 - hir::semantics::Semantics<DB>::find_name_def::he99a1b65a024cbca
  48:     0x597075731bfb - hir::semantics::Semantics<DB>::find_def::h45ade3c9def0c60c
                               at /home/runner/work/sourcepawn-vscode/sourcepawn-vscode/crates/hir/src/semantics.rs:256:28
  49:     0x597075714381 - ide::hover::hover::h21d3863c19304d5a
                               at /home/runner/work/sourcepawn-vscode/sourcepawn-vscode/crates/ide/src/hover.rs:124:15
  50:     0x597075718114 - ide::Analysis::hover::{{closure}}::hbbbc325d790b5f90
                               at /home/runner/work/sourcepawn-vscode/sourcepawn-vscode/crates/ide/src/lib.rs:236:27
  51:     0x597075718114 - ide::Analysis::with_db::{{closure}}::h41d561797f3c6d97
                               at /home/runner/work/sourcepawn-vscode/sourcepawn-vscode/crates/ide/src/lib.rs:193:29
  52:     0x597075718114 - std::panicking::try::do_call::h7b7f01cd6974488a
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panicking.rs:552:40
  53:     0x597075718114 - std::panicking::try::hd5f59449d1fcfdf0
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panicking.rs:516:19
  54:     0x5970757070da - std::panic::catch_unwind::h52143aa3ff26e7bd
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panic.rs:146:14
  55:     0x5970757070da - salsa::Cancelled::catch::ha26d3f3421da51f9
                               at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/salsa-0.17.0-pre.2/src/lib.rs:586:15
  56:     0x5970757070da - ide::Analysis::with_db::hf0e49f0e86465b7c
                               at /home/runner/work/sourcepawn-vscode/sourcepawn-vscode/crates/ide/src/lib.rs:193:9
  57:     0x5970757070da - ide::Analysis::hover::hdcd6f18e1844c8cd
                               at /home/runner/work/sourcepawn-vscode/sourcepawn-vscode/crates/ide/src/lib.rs:236:14
  58:     0x5970755db30a - sourcepawn_lsp::handlers::request::handle_hover::h9c543d67917aa17c
                               at /home/runner/work/sourcepawn-vscode/sourcepawn-vscode/crates/sourcepawn_lsp/src/handlers/request.rs:173:22
  59:     0x597075680eef - sourcepawn_lsp::dispatch::RequestDispatcher::on_with_thread_intent::{{closure}}::{{closure}}::he322c728bece43d3
                               at /home/runner/work/sourcepawn-vscode/sourcepawn-vscode/crates/sourcepawn_lsp/src/dispatch.rs:102:17
  60:     0x597075680eef - std::panicking::try::do_call::h6f4d90038a7c1a02
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panicking.rs:552:40
  61:     0x597075680eef - std::panicking::try::had30fc3d5734a00a
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panicking.rs:516:19
  62:     0x5970755cdfe4 - std::panic::catch_unwind::ha38a3adcabea96e1
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panic.rs:146:14
  63:     0x5970755cdfe4 - sourcepawn_lsp::dispatch::RequestDispatcher::on_with_thread_intent::{{closure}}::h37486bb285c18d3a
                               at /home/runner/work/sourcepawn-vscode/sourcepawn-vscode/crates/sourcepawn_lsp/src/dispatch.rs:100:26
  64:     0x5970755cdfe4 - sourcepawn_lsp::task_pool::TaskPool<T>::spawn::{{closure}}::h318dd4a47535d754
                               at /home/runner/work/sourcepawn-vscode/sourcepawn-vscode/crates/sourcepawn_lsp/src/task_pool.rs:27:33
  65:     0x5970755cdfe4 - stdx::thread::pool::Pool::spawn::{{closure}}::h1f1c6b8381878ea8
                               at /home/runner/work/sourcepawn-vscode/sourcepawn-vscode/crates/stdx/src/thread/pool.rs:86:13
  66:     0x5970755cdfe4 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h11511db13d3b3d1f
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/ops/function.rs:250:5
  67:     0x5970758d0696 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hab106628e811be0f
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/alloc/src/boxed.rs:2020:9
  68:     0x5970758d0696 - stdx::thread::pool::Pool::new::{{closure}}::hbf0dee2e1a441397
                               at /home/runner/work/sourcepawn-vscode/sourcepawn-vscode/crates/stdx/src/thread/pool.rs:61:29
  69:     0x5970758d0696 - stdx::thread::Builder::spawn::{{closure}}::hb8e791cd5b562a07
                               at /home/runner/work/sourcepawn-vscode/sourcepawn-vscode/crates/stdx/src/thread.rs:81:13
  70:     0x5970758d0696 - std::sys_common::backtrace::__rust_begin_short_backtrace::h29b269dddb55ac38
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/sys_common/backtrace.rs:155:18
  71:     0x5970758d22d0 - std::thread::Builder::spawn_unchecked_::{{closure}}::{{closure}}::hf0016d1d73fb8769
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/thread/mod.rs:528:17
  72:     0x5970758d22d0 - <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::h5f5de60de76d136b
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/panic/unwind_safe.rs:272:9
  73:     0x5970758d22d0 - std::panicking::try::do_call::h9ceea470b540080a
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panicking.rs:552:40
  74:     0x5970758d22d0 - std::panicking::try::h0f36e86c17c34251
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panicking.rs:516:19
  75:     0x5970758d22d0 - std::panic::catch_unwind::h11cec82157e19d69
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panic.rs:146:14
  76:     0x5970758d22d0 - std::thread::Builder::spawn_unchecked_::{{closure}}::h756d5d2b483a208f
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/thread/mod.rs:527:30
  77:     0x5970758d22d0 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h21b9e0526fd9494b
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/ops/function.rs:250:5
  78:     0x597075ade585 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h19b9e642d37e7272
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/alloc/src/boxed.rs:2020:9
  79:     0x597075ade585 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h97265befc434d3ae
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/alloc/src/boxed.rs:2020:9
  80:     0x597075ade585 - std::sys::pal::unix::thread::Thread::new::thread_start::h420dad5cf01a9f35
                               at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/sys/pal/unix/thread.rs:108:17
  81:     0x717f0f542ded - <unknown>
  82:     0x717f0f5c60dc - <unknown>
  83:                0x0 - <unknown>
[Error - 14:05:14] Request textDocument/hover failed.
  Message: request handler panicked: index out of bounds: the len is 291 but the index is 496
  Code: -32603

Same index out of bounds error happens with Request textDocument/completion failed.
This seems to happen only with methodmaps. didn't notice same errors for regular functions/callbacks.

Code to reproduce the behaviour

This is enough to reproduce the bug. This code must be moved to separate file for bug to appear.

#if defined _aon_store_inventory_included
methodmap ISmiteBossPlayer < StorePlayer
#else
methodmap ISmiteBossPlayer
#endif
{
    public void SmiteArea(AbilityData abilityData)
    {
        float aimPosition[3];
        GetClientAimPosition(client, aimPosition);
    }
}

Error messages

  ERR request handler panicked: index out of bounds: the len is 44 but the index is 496: Error: request handler panicked: index out of bounds: the len is 44 but the index is 496
    at handleResponse (/home/ivan/.vscode-oss/extensions/sarrus.sourcepawn-vscode-7.2.11/node_modules/vscode-jsonrpc/lib/common/connection.js:565:48)
    at handleMessage (/home/ivan/.vscode-oss/extensions/sarrus.sourcepawn-vscode-7.2.11/node_modules/vscode-jsonrpc/lib/common/connection.js:345:13)
    at processMessageQueue (/home/ivan/.vscode-oss/extensions/sarrus.sourcepawn-vscode-7.2.11/node_modules/vscode-jsonrpc/lib/common/connection.js:362:17)
    at Immediate.<anonymous> (/home/ivan/.vscode-oss/extensions/sarrus.sourcepawn-vscode-7.2.11/node_modules/vscode-jsonrpc/lib/common/connection.js:334:13)
    at processImmediate (node:internal/timers:478:21)
@MAGNAT2645 MAGNAT2645 added the bug Something isn't working label Jun 12, 2024
@MAGNAT2645
Copy link
Author

This issue seems to be related to #399.

@MAGNAT2645
Copy link
Author

Somehow after manually switching to 7.2.12 and reloading the window VSCodium said that I'm still on 7.2.11 and at that moment I noticed the ext was renamed to SourcePawn Studio but it was just SourcePawn before updating.
After another update error didn't disappear but the index was changed.
Now it says
index out of bounds: the len is 291 but the index is 510

@Alienmario
Copy link

It's working for me in 7.2.12

@MAGNAT2645
Copy link
Author

Yeah, it seems that the ext does not like it when I'm working on decompiled code or when there are a lot of macros using each other in their definitions.

@Alienmario
Copy link

But same code does not throw such errors if you move it to the main file.

It can be caused by something above the given code in that file. I recommend deleting code until it starts working to help identify the real cause.

@MAGNAT2645
Copy link
Author

MAGNAT2645 commented Jun 15, 2024

It seems that these errors happen when I have lines like this

#if defined _aon_store_inventory_included
methodmap IHealerBossPlayer < StorePlayer
#else
methodmap IHealerBossPlayer
#endif
{

If I change it to just methodmap IHealerBossPlayer or methodmap IHealerBossPlayer < StorePlayer, errors seem to disappear. No, this happens due to using inheritance. Just using methodmap IHealerBossPlayer does not cause this bug.

@Alienmario
Copy link

Post StorePlayer definition.

@MAGNAT2645
Copy link
Author

MAGNAT2645 commented Jun 15, 2024

I cant post whole code here but basically StorePlayer is this combination:

enum StorePlayer
{
    STORE_INVALID_PLAYER = 0
};

methodmap StorePlayer < PLSPlayer
{
    public native bool ShowInventory();
    public native bool ShowEquipments();
    
    public native bool IsInvSlotEmpty(int slot);
    
    public native int GiveItem(
        StoreItem item,
        int quantity = 1,
        AcquireMethod method = AcquireMethod_Unknown,
        DateTime expiryDate = ZERO_DATETIME,
        JSON_Object attributes = null,
        bool save  = true,
        bool sound = true
    );
    public native void UseInvItem(int slot, bool backToPanel = true, StorePlayer target = STORE_INVALID_PLAYER);
    public native void EquipInvItem(
        int slot,
        StoreEquipmentSlot equipSlot,
        bool save = false,
        bool sound = true,
        StorePlayerSyncCB callback = INVALID_FUNCTION,
        any data = 0
    );
    
    public native bool RemoveInvItemAttr(
        int slot,
        const char[] attribute,
        bool save = true,
        StorePlayerSyncCB callback = INVALID_FUNCTION,
        any data = 0
    );
    public native any  GetInvItemAttrValue(int slot, const char[] attribute, any defaultValue = 0);
    public native bool SetInvItemAttrValue(
        int slot,
        const char[] attribute,
        any value,
        bool toNewSlot = true,
        bool save = true,
        int& newSlot = INVALID_INV_SLOT
    );
    
    // ...
};
enum PLSPlayer
{
    PLS_INVALID_PLAYER = 0
};

methodmap PLSPlayer < AON_Client
{
    public native void LevelUp(int amount = 1);
    public native void RankUp(int amount = 1);    
    
    property PLSPlayerRole Role
    {
        public native get();
    } 
    public native void SetRole(PLSPlayerRole role, DateTime expiryDate = ZERO_DATETIME, bool save = true);
    
    public native int GetCustomRoleName(char[] buffer, int maxlength);
    public native void SetCustomRoleName(const char[] value);
    
    property RGBAColor CustomRoleColor1
    {
        public native get();
        public native set(RGBAColor color);
    }
    property RGBAColor CustomRoleColor2
    {
        public native get();
        public native set(RGBAColor color);
    }       
    
    property PLSPlayerRank Rank
    {
        public native get();
    }
    
    property int EXP
    {
        public native get();
    }
    
    // ...
};
enum AON_Client
{
    AON_INVALID_CLIENT = 0
};

methodmap AON_Client
{
    public static native AON_Client FromMemberId(int id);
    
    public native bool IsAuthorized();
    public native bool IsDevModeEnabled();
    
    property DateTime JoinDate
    {
        public native get();
    }
    property int MemberId
    {
        public native get();
    }
    
    public native TimeSpan GetTotalTime(bool currentSession = true);    
    
    public native bool GetFlagState(const char[] flag, bool defaultState = false);
    public native void SetFlagState(const char[] flag, bool newState, bool save = true);   
    
    public native bool HasAttr(const char[] attribute);
    public native bool RemoveAttr(const char[] attribute, bool save = true);
    
    public native any  GetAttrValue(const char[] attribute, any defValue = 0);
    public native bool SetAttrValue(const char[] attribute, any value, bool save = true);
    public native bool GetAttrBoolValue(const char[] attribute, bool defValue = false);
    public native bool SetAttrBoolValue(const char[] attribute, bool value, bool save = true);
    public native float GetAttrFloatValue(const char[] attribute, float defValue = 0.0);
    public native bool  SetAttrFloatValue(const char[] attribute, float value, bool save = true);
    public native int GetAttrStringValue(const char[] attribute, char[] buffer, int maxlength, const char[] defValue = "");
    public native int SetAttrStringValue(const char[] attribute, const char[] value, bool save = true);
    public native JSON_Object GetAttrObjectValue(const char[] attribute, JSON_Object defValue = null);
    public native bool        SetAttrObjectValue(const char[] attribute, JSON_Object value, bool save = true);
        
    property ArrayStack MenuData
    {
        public native get();
    }
         
    // ...
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants