Closed gm-bug-reporter[bot] closed 5 months ago
Fixed in 2024.4
Well... I just spent a good hour or so trying to figure out the root cause, and right as I'm about to post my test results, you go and mark it as fixed. All that effort...
Ahh well. I'll still post it because it highlights what can and can't cause the issue, so that if anyone else was Googling the error and finding no results like me, they have something they can refer to.
@rwkay , is there a chance you'd be able to offer some more insights as to what exactly could trigger the error, and how to get around it? Below was what I found.
I've done some debugging of my own, and I've come up with an easy way to replicate the issue from scratch in a brand new project - but there are some funky twists:
objX
, objA
, and objB
.objA
the parent of objB
.objB
. Call it anything, but make it of the type expression
.objB
instance to be equal to the ID/name of the objX
instance ("inst_XXXXXX" by default, but you can rename the objX
instance, just so long as the 'Variable Definition' on the objB
instance matches)
7. Run the game, and observe the igor fail.objA
instance from the room, and change the parent of objB
to be objX
.
9. Run the game, and observe that there is no build fail.objC
.objC
as objB
's parent, and add it in to the room. This should now mirror the first test, but with objC
instead of objA
.
12. Run the game, and observe that there is no build fail.I then deleted all objects, made 3 new ones (obj1
, obj2
, and obj3
), and tried again, but even more simple:
Room setup: Single instance of obj2
with 'Variable Definition' a
(type: expression) equal to its own instance ID in the room editor (in this case, inst_2D718190
).
Test A: obj1
is parent of obj2
. Result: Build Fail.
Test B: Changed obj2
: obj3
is now parent of obj2
. Result: Build Succeed.
Test C: Replaced obj2
instance with obj3
instance, made obj2
the parent of obj3
, gave obj3
new 'Variable Definition', equal to its own instance ID. Cleared all other inheritance. Result: Build Succeed.
Test D: Changed obj3
: obj1
is now parent of obj3
. Result: Build Failed.
Test E: Created obj0
. Made it the parent of obj1
. Cleared all other inheritance. Put instance of obj1
in room to replace obj3
instance, made same 'Variable Definition' setup on obj1
that other objects had received. Result: Build Success. (This test was to determine if the order of objects in the Objects view in the Asset Browser somehow influenced the outcome)
Test F: Reversed obj0
and obj1
relationship, replaced instance of obj1
in room with obj0
instance, same 'Variable Definition' setup, etc. Result: Build Failed.
In the second demonstration, it seems that only when a object had obj1
as its parent did it cause the build failure. Why? Who knows!
Basically there was an incorrect range check on the index to an array - more fundamentally it was checking the wrong array (used in an older project file format, this has also been fixed)
Russell
Verified fix in IDE v2024.400.0.542 Runtime v2024.400.0.561, thanks.
Description
The attached project was last opened and run in March 2023, with what was the latest IDE and Runtime. I've just reopened it, with what is now the latest IDE and Runtime (v2024.2.0), and I get the following error at this step in the compilation process:
Writing Chunk... DFNC size ... 0.01 MB Writing Chunk... STRG size ... 0.00 MB Stats : GMA : Elapsed=526.0683 Stats : GMA : sp=41,au=0,bk=0,pt=0,sc=162,sh=6,fo=0,tl=0,ob=43,ro=14,da=0,ex=0,ma=13,fm=0x8000A21D787C02A0 System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.AggregateException: One or more errors occurred. (Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')) (Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')) (Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')) (Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')) (Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')) (Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')) ---> System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index') at System.Collections.Generic.Listb1(GMInstance inst)
at System.Threading.Tasks.Parallel.<>cDisplayClass44_0`2.b 1(IEnumerator& partitionState, Int32 timeout, Boolean& replicationDelegateYieldedBeforeCompletion)
--- End of stack trace from previous location ---
1.get_Item(Int32 index) at GMAssetCompiler.GMObject.GetPropertyInParent(GMAssets a, Int32 parent, String property) at GMAssetCompiler.GMObject.GetUndefinedVariables(GMAssets a, GMObject obj, List
1 variables, String value) at GMAssetCompiler.GMInstance.<>cDisplayClass98_0.I do not know what's changed in the runtime or IDE since 03/2023, but something has which is now causing this issue. It could potentially be some sort of unstable variable declaration in the project that was previously handled differently, I'm not entirely sure.
Steps To Reproduce
Open the project, then try to run it (Target: Windows > GMS2 VM > Default > Default).
Which version of GameMaker are you reporting this issue for?
IDE v2024.2.0.132 Runtime v2024.2.0.163
Which operating system(s) are you seeing the problem on?
Windows 10.0.26002.0
c5fe5362-20ef-4743-926b-6583641cf9f6