WerWolv / ImHex

🔍 A Hex Editor for Reverse Engineers, Programmers and people who value their retinas when working at 3 AM.
https://imhex.werwolv.net
GNU General Public License v2.0
44.67k stars 1.95k forks source link

[Bug] crashed during initial setup (startup app after install crashes before gui) - settings json handling problem #1514

Closed vanillaSprinkles closed 8 months ago

vanillaSprinkles commented 9 months ago

Operating System

Windows

What's the issue you encountered?

on windows 10; just installed of 1.32.2 (previously had 1.22? cannot find the old installer) and launching the app. The gui briefly shows the hex-number but then has the crash popup and a blank gui (only boarder is drawn, blackness consumes the rest of the area)

just opening the app gives: Error (title)

ImHex crashed during initial setup!
Error: nlohmann::json_abi_v3_11_2::detail::type_error():what() -> [json.exception.type_error.32] type must be string, but is number

How can the issue be reproduced?

download the MSI from https://github.com/WerWolv/ImHex/releases/tag/v1.32.2 install on win10 run app from start-menu

ImHex Version

1.32.2

ImHex Build Type

Installation type

MSI

Additional context?

Just tried the imhex-1.32.2-Windows-Portable-x86_64.zip file and it loads imhex.exe without a problem

vanillaSprinkles commented 9 months ago

ok - i ran a diff between the folders and it came up with the following:

imhex-1.32.2-Windows-Portable-x86_64]$ git diff --name-status  ../../Program\ Files/ImHex/  .
A       ./PORTABLE
A       ./config/achievements.json
A       ./config/settings.json
M       ../../Program Files/ImHex/workspaces/default.hexws

starting from the bottom, copying in the portable's files into the installed-dir:

finally:

Doing a diff in the localappdata imhex: turns out its the config/settings.json file ; quite a bit of differences to be fair - so i think it has to do wtih a deprecated setting causing the crash (i can probably do more research) - but really the settings loader might handle outdated entries better.

if i had to guess it is items like (old) "hex.builtin.setting.general.auto_load_patterns": 1 vs (new) "hex.builtin.setting.general.auto_load_patterns": true

WerWolv commented 9 months ago

Hey! Could you send me your settings.json file by any chance? Definitely sounds like an upgrade issue from these old versions. Should be very easy to fix if I can reproduce it

vanillaSprinkles commented 8 months ago

of the breaking one, here goes; i forget the actual version that created this (or rather the version i had running before the latest install - though i have an installer that is imhex-1.21.2-win64.msi which is likely the one)

{
    "hex.builtin.setting.folders": {
        "hex.builtin.setting.folders": [],
        "hex.builtin.setting.folders.description": []
    },
    "hex.builtin.setting.font": {
        "hex.builtin.setting.font.custom_font_enable": false,
        "hex.builtin.setting.font.custom_font_info": null,
        "hex.builtin.setting.font.font_antialias": true,
        "hex.builtin.setting.font.font_bold": false,
        "hex.builtin.setting.font.font_italic": false,
        "hex.builtin.setting.font.font_path": "",
        "hex.builtin.setting.font.font_size": 13,
        "hex.builtin.setting.font.load_all_unicode_chars": false
    },
    "hex.builtin.setting.general": {
        "hex.builtin.setting.general.auto_backup_time": 0,
        "hex.builtin.setting.general.auto_load_patterns": 1,
        "hex.builtin.setting.general.context_menu_entry": 0,
        "hex.builtin.setting.general.network_interface": false,
        "hex.builtin.setting.general.save_recent_providers": true,
        "hex.builtin.setting.general.server_contact": 2,
        "hex.builtin.setting.general.show_tips": 1,
        "hex.builtin.setting.general.sync_pattern_source": 0,
        "hex.builtin.setting.general.upload_crash_logs": true
    },
    "hex.builtin.setting.hex_editor": {
        "hex.builtin.setting.hex_editor.advanced_decoding": 1,
        "hex.builtin.setting.hex_editor.ascii": 1,
        "hex.builtin.setting.hex_editor.byte_padding": 0,
        "hex.builtin.setting.hex_editor.bytes_per_row": 16,
        "hex.builtin.setting.hex_editor.char_padding": 0,
        "hex.builtin.setting.hex_editor.grey_zeros": 1,
        "hex.builtin.setting.hex_editor.highlight_color": 1623228544,
        "hex.builtin.setting.hex_editor.sync_scrolling": false,
        "hex.builtin.setting.hex_editor.uppercase_hex": 1,
        "hex.builtin.setting.hex_editor.visualizer": "hex.builtin.visualizer.hexadecimal.8bit"
    },
    "hex.builtin.setting.interface": {
        "hex.builtin.setting.interface.color": 0,
        "hex.builtin.setting.interface.force_borderless_window_mode": false,
        "hex.builtin.setting.interface.fps": 60,
        "hex.builtin.setting.interface.language": "en-US",
        "hex.builtin.setting.interface.layout_locked": false,
        "hex.builtin.setting.interface.multi_windows": true,
        "hex.builtin.setting.interface.pattern_data_row_bg": false,
        "hex.builtin.setting.interface.restore_window_pos": false,
        "hex.builtin.setting.interface.scaling": 0,
        "hex.builtin.setting.interface.scaling_factor": 0.0,
        "hex.builtin.setting.interface.show_resource_usage": false,
        "hex.builtin.setting.interface.wiki_explain_language": "en"
    },
    "hex.builtin.setting.proxy": {
        "hex.builtin.setting.proxy.enable": false,
        "hex.builtin.setting.proxy.url": ""
    }
}
WerWolv commented 8 months ago

Thank you! I made a bunch of changes to the settings interface now so it can ignore and default-initialize settings values that it doesn't understand instead of just crashing. This will be fixed in the next release (or the nightly that's being built right now if you'd like to use that)