UnderminersTeam / UndertaleModTool

The most complete tool for modding, decompiling and unpacking Undertale (and other GameMaker games!)
GNU General Public License v3.0
1.18k stars 226 forks source link

System.Collections.Generic.KeyNotFoundException #1052

Open themabus opened 2 years ago

themabus commented 2 years ago

Describe the bug

following code from GMS 1.4.9999 produces exception in v0.4.0.4 and v674c5d8 bleeding edge System.Collections.Generic.KeyNotFoundException: The given key '_temp_local_var_1' was not present in the dictionary. but decompiles in at least v0.1.25, v0.3.0, v0.3.5.8

` list = ds_list_create(); list[| 0] = self;

show_debug_message(ds_list_find_value(list, 0).speed); list[| 0].speed += 1; (ds_list_find_value(list, 0)).speed += 1; show_debug_message(ds_list_find_value(list, 0).speed); ` the fault is in increment operation

Reproducing steps

decompile attached data.win test.zip

Setup Details

v0.4.0.4 and v674c5d8 Win 10 x64

Miepee commented 2 years ago

System.Collections.Generic.KeyNotFoundException: The given key '_temp_local_var_1' was not present in the dictionary.

Can you post the full stacktrace instead of just the error message?

themabus commented 2 years ago
/* EXCEPTION!
   System.Collections.Generic.KeyNotFoundException: The given key '_temp_local_var_1' was not present in the dictionary.
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at UndertaleModLib.Decompiler.Decompiler.DecompileFromBlock(DecompileContext context, Dictionary`2 blocks, Block block, List`1 tempvars, Stack`1 workQueue) in D:\a\UndertaleModTool\UndertaleModTool\UndertaleModLib\Decompiler\Decompiler.cs:line 2194
   at UndertaleModLib.Decompiler.Decompiler.DecompileFromBlock(DecompileContext context, Dictionary`2 blocks, Block block) in D:\a\UndertaleModTool\UndertaleModTool\UndertaleModLib\Decompiler\Decompiler.cs:line 2618
   at UndertaleModLib.Decompiler.Decompiler.Decompile(UndertaleCode code, GlobalDecompileContext globalContext) in D:\a\UndertaleModTool\UndertaleModTool\UndertaleModLib\Decompiler\Decompiler.cs:line 3769
   at UndertaleModTool.UndertaleCodeEditor.<>c__DisplayClass31_1.<DecompileCode>b__1() in D:\a\UndertaleModTool\UndertaleModTool\UndertaleModTool\Editors\UndertaleCodeEditor.xaml.cs:line 456
*/

this? this is all I get here, I'm not using special debug build or anything

Miepee commented 2 years ago

Yes, thanks. This already shows from where the error is originating from, and helps devs the bit of time needing to repro it themselves before they can start tracking it down.