Unhandled exception on all screens that use [snip edit: a somehow faulty asset]

FrankenGraphics

New member
Description:

My project file just became a bit untenable...
If i open up the screen editor on any screen using mainTiles01, i get an unhandled exception. This effectively means the screen editor doesn't load, so these screens are now uneditable.
Rolling back to a previous backup is not an option - too much work would be lost.
I might delete these rooms and see what that does- but i'd rather hex edit whatever is causing the trouble. Anybody got a suggestion or encountered the same problem?

More importantly, i want to be sure not stepping on this landmine again later in the process; that'd be devastating.

Only difference i can think of since it last worked is that i added more tilesets to the project folder. I haven't updated this particular tileset though in a day, and it worked in-between when i started today.

************** Exception Text **************
System.ArgumentNullException: Value cannot be null.
Parameter name: value
at System.Windows.Forms.ImageList.ImageCollection.Add(Image value)
at MysticSearchesTool.AssetSelectControl.AddImage(GraphicAsset ga, Guid g)
at MysticSearchesTool.ScreenControl.ResetAllImages()
at System.Windows.Forms.ComboBox.OnSelectedIndexChanged(EventArgs e)
at System.Windows.Forms.ComboBox.set_SelectedIndex(Int32 value)
at MysticSearchesTool.ScreenControl.Init()
at MysticSearchesTool.MysticSearchToolMainDialog.ScreenSelectedFromMap(String MapName, Dictionary`2 Map, Point p, Guid screenguid)
at MysticSearchesTool.MapControl.mapPainter_ScreenSelected(Dictionary`2 Map, Point p, Guid g)
at MysticSearchesTool.MapPainter.OnDoubleClick(EventArgs e)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.UserControl.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
Assembly Version: 4.0.0.0
Win32 Version: 4.7.3362.0 built by: NET472REL1LAST_C
CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll
----------------------------------------
NESMaker
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/nesdev/NESmaker_4_1_0_GOOD/NESMaker_4_1_0.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 4.0.0.0
 

FrankenGraphics

New member
Updates:
-Selecting MainTiles01 for a new screen result in the same error immediately, so the trouble can probably be isolated to the tileset or assets loading, rather than the screen attributes.

-Reimporting the chr file and overwriting the corresponding bmp doesn't solve the issue.

-Trying to examine if assets with dependencies to MainTiles01 are at fault.. but there's so many assets and i don't really know what i'm looking for.

-Opening a new window with the "faulty tileset" selected actually still lets me edit it as long as i don't back out. Some of the old assets are loaded, but not others - whole asset groups are surprisingly empty; giving me a bit of a lead on when the exception happens. I'm going to attempt removing all associated assets as that's not destructive to the screen files themselves and see what that does.

SOLVED.. ish.
-Okay, so removing the asset where the screen editor stopped loading them in made the bug dive under the surface again. What caused the asset to suddenly go bad is a bit of a mystery. Migh've been something with duplicating it or modifying its attributes. I honestly don't know.

But at least i know what to look for if it happens again.
 

Mugi

Member
Ive ran into this once, but never found a solution either.
To gain acess to the screen editor, i had to literally delete assets until i got to the "bad" one.
Originally i thought it had something to do with deleting an asset that was still being used, but that was not the case.
 

FrankenGraphics

New member
If it happens again to anyone, i recommend picking a vacant screen (when they're green) or delete a single screen if they're all occupied. Then, double click that one and if it doesn't go sour immediately, step through your tilesets until a bad asset is attempted to load in your list. Since the editor is still loaded up at this point as long as you don't back out (it isn't if you try to open a pre-existing screen with a bad asset), you can browse the asset pick list to the left. the last correctly loaded asset will indicate that the one right after is bad. Go to your assets and delete it. If more than one is bad, rinse and repeat.
 

Mugi

Member
this is a bit of a stupid question but it just popped in my mind while reading this thread.
im assuming you are using an external program to draw your graphics and then saving them into the bmp files in the graphicsassets folder?
if so, what program you use for this.

i managed to get an error pop up by having one of my bckchr files opened in paint shop pro, and creating assets while the image was open.
im suspecting the cause is that when you create assets, the asset actually stores a bitmap that contains the graphic of that assets (the tiles it uses are cut from the bmp file and saves as a small image inside the asset itself)
and thus, creating an asset while the bitmap is open in paintshop pro, prevents nesmaker from actually accessing the file (the specific version of PSP i use is really old, and it completely locks opened files into itself.)

this results in the asset actually being made, but exiting and re-entering returns the "value cannot be null" error, because the asset graphic has failed to be loaded into the asset upon creation, hence it's value is null
 

FrankenGraphics

New member
Hm.. I'm pretty sure that isn't it in my case; because i make all my graphics in NESST, then use the CHR import tool in NESmaker to convert and overwrite the RGBB indexed BMP files. At one point i had specified the wrong file size which resulted in a related error, but it was just the matter of overwriting it with a correct size one more time.

So i think there must be other triggers beside the file being r/w protected by external tool. It's good to know though so it can be avoided, thanks for making that observation!

From my point of view it'd been preferrable (and possibly more robust) if NESmaker operated on NES-ready chr files directly, as opposed to convert chr to bmp just to convert them back to chr at build time, but it is what it is. Also, i know not everyone prefers using NESST or YY-CHR.
 

Mugi

Member
well i will keep an eye on it in any case.

this bug can be really devastating for projects so it would be really nice to get down to the root cause and prevent it from happening again. (in my case accessing the screen painter was completely off until i'd deleted some 80% of my assets, redoing them was not fun.)
 

FrankenGraphics

New member
Yeah, generating a good bunch of assets can easily take half a day.

At least it's a benefit with the assets working like stampclones for editing raw data, as opposed to being actual assembly structures (as used in tloz, metroid, smb3 etc) - there are no dependencies in the level data itself to the asset, just a dependency for displaying it in the editor.


About the time it takes to make new assets.. if drop down menus remembered the last selected items instead of defaulting to item 0, asset generation and screen setups would be considerably more streamlined.

Other things that would help would be if you could:

-open an asset editor in a popup when double clicking it from the asset picker in screen editing mode (so you don't need to back out),

-open a minimap popup of the over/underworld from the screen editor without having to back out.

while i'm at it, remove the assembly error dialog box completely. The command window already tells about all the errors adequately, and if you want to use the in-tool text editor to correct them, you need it to remain open. the dialogue box prohibits any editing while it is open, and if you close it, it also closes the command prompt with the error listing. I use an external text editor either way, but sometime it'd still be useful, especially for those who want to do all in one tool.
 
Top Bottom